On Jun 28, 5:22 am, Alexis ROBERT <
alexis.rob...@gmail.com> wrote:
> I have an other issue which concern UTF-8 parsing.
>
> The strangest thing is that it runs perfectly on the emulator, but not
> on my ADP1 (firmware 1.5).
That seems backward -- CheckJNI is enabled by default on the emulator,
but not on the device.
> W/dalvikvm( 3899): JNI WARNING: illegal continuation byte 0x45
> W/dalvikvm( 3899): string: 'EMPYRÉAL, ALE EMMAIGRI'
> W/dalvikvm( 3899): in Lorg/alexis/libstardict/
> Index;.getRawWords (Ljava/lang/String;)[Ljava/lang/String;
> (NewStringUTF)
>
> I've checked my file, it's a well-formed UTF-8 file. On this segment,
> the string is 45 4d 50 59 52 c3 89 41 4c 2c 20 41 4c 45 00 (which
> seems to be a valid UTF-8 string).
Something isn't quite right -- the hex string you gave is "EMPYR<E>AL,
ALE\0", but the string printed by CheckJNI continues on past that. So
the VM isn't choking on what you think it's choking on.
> On the same time, EMMAIGRI is around the position 0x000bab60 in my
> file, where EMPYRÉAL is around 0x000bd2d0 (so it's not a missing '\0'
> delimiter). The parser reads the data in a linear way, so EMMAIGRI was
> already in memory.
Do you have gdb/gdbserver set up? If so, you can attach gdb and catch
it at the point of the break. Move up the stack to your code and hex-
dump the string that's being passed into NewStringUTF.
Alternatively, extract checkUtfString() from dalvik/vm/CheckJni.c, add
it to your code, and call it right before the NewStringUTF call. Then
you can just add printfs to get additional diagnostics.