comp.lang.ada
 help / color / mirror / Atom feed
From: "Terry Westley" <westley@yahoo.com>
Subject: JGNAT: java strings converted to Ada have 'first = 0
Date: Wed, 03 Jan 2001 03:23:38 GMT
Date: 2001-01-03T03:23:38+00:00	[thread overview]
Message-ID: <_Ww46.64$4n5.2562@news1.news.adelphia.net> (raw)

In using JGNAT, I find that when I convert Java.Lang.String.Ref to an
Ada string, it's 'first is 0!

This really causes havoc (constraint_error) in some situations.  I don't
see anything in the JGNAT user guide about this.

Perhaps I'm converting them incorrectly...

   procedure To_String (JStr : in Java.Lang.String.Ref) return String is
      use Java.Lang.String;
      JStr_Access : Java.Lang.String.String_Access;
   begin -- To_String
      if JStr = null then
         return "";
      end if;
      JStr_Access := +JStr;
      return JStr_Access.all;
   end To_String;

--
Terry Westley
twestley@acm.org
Learn about TASH, an Ada binding to Tcl/Tk at http://www.adatcl.com






                 reply	other threads:[~2001-01-03  3:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox