Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Different behavior for newStringUTF() for Sun JVM and IBM Jvm

Reply
Thread Tools

Different behavior for newStringUTF() for Sun JVM and IBM Jvm

 
 
Lasse
Guest
Posts: n/a
 
      12-15-2003
While changing environment for our application into IBM's JVM (build
1.4.1) we suddenly run into problems with Swedish chars like жде when
returning them from our native calls.

Some testing helped us to isolate the error into a row in the code
where we return the result from our c-code into an array in the Java
layer:

(*env)->SetObjectArrayElement(env,ret,i, (*env)->NewStringUTF(env,
word));

When running the compile code with -verbose, the following infromation
shows up:
Loaded java.io.CharConversionException from
/opt/IBMJava2-141/bin/../jre/lib/core.jar

After changeing back into SUN's JVM (build 1.4.2_03-b02) everything
works fine again. The same for SUN's Build 1.3.1 and Build 1.3.0.

Just courios if anybody knows if this is a documented bug/feature for
the IBM JVM? Have someone else discovered the same problem and perhaps
have a solution / answar for the behavior?

Som furter env. information:
Linux ES release 2.1 (Panama)
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-118.7.2)

IBM JVM:
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
Classic VM (build 1.4.1, J2RE 1.4.1 IBM build cxia321411-20030930 (JIT
enabled: jitc))

SUN JVM:
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
 
Reply With Quote
 
 
 
 
Jon A. Cruz
Guest
Posts: n/a
 
      01-05-2004
Lasse wrote:
> While changing environment for our application into IBM's JVM (build
> 1.4.1) we suddenly run into problems with Swedish chars like жде when
> returning them from our native calls.
>
> Some testing helped us to isolate the error into a row in the code
> where we return the result from our c-code into an array in the Java
> layer:
>
> (*env)->SetObjectArrayElement(env,ret,i, (*env)->NewStringUTF(env,
> word));


Soo... what exactly are the bytes you are feeding to that call? Are they
proper UTF-8 bytes, or are you feeding the local charset 8-bit encoding
instead?

>
> When running the compile code with -verbose, the following infromation
> shows up:
> Loaded java.io.CharConversionException from
> /opt/IBMJava2-141/bin/../jre/lib/core.jar


Sounds like it's yelling at you for feeding it some malformed data.

Did you use the JNI calls to check for errors? You should be calling
that after each call into JNI. If so, you'd probably see the result of
that exception.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sun rejects IBM buyout, IBM withdraws offer Qu0ll Java 42 04-13-2009 10:53 AM
Sun Updates Sun Java Availability Suite, Adds Sun Cluster Advanced Edition for Oracle Real Application Clusters Deployments technology_post@yahoo.com Java 0 04-05-2006 04:29 AM
JVM: IBM vs Sun Jimmy Zhang Java 0 02-21-2004 08:35 PM
MS JVM and Sun JVM problem Young-Jin Lee Java 3 01-21-2004 04:25 AM
Re: Handling both MS JVM and Sun JVM Kevin Hooke Java 2 09-02-2003 05:31 AM



Advertisments