Null-terminated Unicode strings in java.io on Windows

Mark Wielaard mark at klomp.org
Fri Jan 25 13:14:32 UTC 2008


Krzysztof Żelechowski <program.spe at ...> writes:
> If the specification gets fixed so that GSC result MUST be z-term, 
> your VM will cease being conformant 
> so it will be fixed and no additional buffers will be needed. 

Eh, that doesn't seem right at all.
The specification currently doesn't guarantee that the result is a jchar array
that is zero terminated. So you can expect current runtimes not to do this. As
Roman said at least JamaicaVM doesn't do this. I just checked the
implementations gcj and jamvm, they both also don't make any such guarantee
(cacao does seem to add an extra 0 at the end of the result it returns though).
So "clarifying the spec" would break a lot of code of currently conforming
implementations. The code relying on this behavior seems to be just buggy and
should be fixed imho.

Cheers,

Mark




More information about the core-libs-dev mailing list