StringTokenizer bug?
Juergen Sonnauer
kaffe@rufus.w3.org
Sun, 26 Jul 1998 20:12:18 +0000 ()
Thanks for your response. It runs correct in your environment,
so i could have an outdated system:
libc.so.5.2.18, libdl.so.1.7.17, libm.so.5.0.5
gcc-2.7.2, XFree86-3.1.2, libX11.so.6.0
> On Sun, 26 Jul 1998, Juergen Sonnauer wrote:
> >The following example shows a bug which i cannot resolve at the
> >moment. It might be in the class StringTokenizer or in the native
> >AWT layer...
>
> ..picked up my magic word "AWT layer"..
>
> What exactly do you mean by "shows a bug". I get the following output:
> $ k TestIt
> Key: one, Value: Hello
> Key: two, Value: Party
> Key: three, Value: Fun
> Key: four, Value: Beer
> drawString: Party
> drawString: Party
My output shows the following:
$ Kaffe TestIt
Key: one, Value: Hello
Key: two, Value: Party
Key: three, Value: Fun
Key: four, Value: Beer
drawString: Party
graDrawString: one:H <-- on stdout and canvas
drawString: Party
graDrawString: Party
Here is how i added printf to the graDrawString function:
---
void
Java_java_awt_Toolkit_graDrawString ( JNIEnv* env, jclass clazz,
Graphics* gr, jstring str, jint x, jint y )
{
jboolean isCopy;
int n, len;
const jchar *jc;
XChar2b *b;
if ( !str ) return;
len = (*env)->GetStringLength( env, str);
jc = (*env)->GetStringChars( env, str, &isCopy);
#ifndef WORDS_BIGENDIAN
n = sizeof(XChar2b)*len;
b = (XChar2b*) getBuffer( X, n);
swab( jc, b, n);
#else
b = (XChar2b*) jc;
#endif
{
int i;
printf("graDrawString: ");
for (i = 0; i < len; i++)
printf("%c", b[i].byte2);
printf("\n");
}
XDrawString16( X->dsp, gr->drw, gr->gc, x+gr->x0, y+gr->y0, b, len);
(*env)->ReleaseStringChars( env, str, jc);
}
---
>
> and the Canvas shows "Party Party", as it is supposed to do. Just add a printf
> to the libraries/awt/X/gra.c graDrawString() to see what gets in there (jchar
> wise) and let me know.
>
> Can anybody else reproduce this?
>
> --
> Peter Mehlitz Tel: +1 510 704 1660
> Transvirtual Technologies, Inc., Fax: +1 510 704 1893
> http://www.transvirtual.com Email: peter@transvirtual.com
Prost!
--
Juergen Sonnauer
eMail: sonic@az-online.net