Null-terminated Unicode strings in java.io on Windows

Roman Kennke roman.kennke at aicas.com
Mon Jan 21 22:57:42 UTC 2008


Hi,

Am Montag, den 21.01.2008, 14:45 -0800 schrieb Tim Bell:
> Alan Bateman wrote (about GetStringChars):
> 
> > [...] is length+1 and zero terminated. There is a long-standing bug to clarify the JNI specification on this topic. I believe it should say that the returned array of Unicode characters is not required to be zero terminated and that one should use GetStringLength to determine the length.
> 
> Roman Kennke wrote:
> 
> > So this is indeed a bug, right? Do you think it makes sense to go out and fix it?
> 
> I'd start here:
> 
>    4616318 Spec for JNI's GetStringChars() is incomplete
>    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4616318

Hmm, I'm not talking about fixing the spec (I've read that bug report
while searching for clarfication on the spec actually). When the spec
doesn't tell _that_ the returned array is zero terminated, I think we
should assume that it isn't (and it seems to be the trend that the spec
should be clarfied by saying that an implementation isn't required to
return a zero-terminated array, but this is only speculation). What I'm
asking is, should we fix the java.io C code to deal with
non-zero-terminated jchar arrays? Unfortunately, this probably means
allocating additional buffers, because we really need zero terminated
strings here (AFAICS).

/Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




More information about the core-libs-dev mailing list