[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gzz] jnistrconv.test
From: |
Asko Soukka |
Subject: |
Re: [Gzz] jnistrconv.test |
Date: |
Thu, 14 Nov 2002 09:30:01 +0200 (EET) |
Wed, 13 Nov 2002, Benja Fallenstein kirjoitti:
> I get a single Failure in jnistrconv.test:
> testUniScandJavaSubstr_without_stringlength fails, the rest goes
> through. (I'm using the same VM as before.)
Great! It won't fail with my VM (Sun's 1.4).
> Does that mean the bug is fixed?
> Why is LinebreakingCellContentView broken?
It should mean that. Can you still show me the AssertionError's
message? Did it look familiar?
The bug was on the C++ side as you guessed earlier.
Try to consider a couple code examples below. In the first versio
a string is created from a pointer got from JNI, but without defining
the exact length of the string. I believe, the only way to defined the
length of the string, is to find the first null-char next to the
pointers address - and that why it propably fails when using
String.substr().
Now all JNI-string are converted into C++-strings through the
same function (look at the second example), which asks the length
of the string from JNI. All the other tests than "_withouth_stringlength"
use this function.
Failing version:
const jchar *strptr = env->GetStringChars(jstr, 0);
unistring unistr(strptr);
Working version (although, unistring is currenty unicodecharvector):
const jchar *strptr = env->GetStringChars(jstr, 0);
unistring unistr(strptr, env->GetStringLength(jstr));
--
Asko Soukka | Taitoniekantie 9 A 603 | address@hidden
+358-40-8235947 | FIN-40740 JYVÄSKYLÄ | http://www.iki.fi/asko.soukka/