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

Discussion in 'Java' started by Lasse, Dec 15, 2003.

  1. Lasse

    Lasse Guest

    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)
    Lasse, Dec 15, 2003
    #1
    1. Advertising

  2. Lasse

    Jon A. Cruz Guest

    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.
    Jon A. Cruz, Jan 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jimmy Zhang

    JVM: IBM vs Sun

    Jimmy Zhang, Feb 21, 2004, in forum: Java
    Replies:
    0
    Views:
    4,348
    Jimmy Zhang
    Feb 21, 2004
  2. Hicks
    Replies:
    1
    Views:
    950
    Roedy Green
    Jun 30, 2004
  3. Naresh Agarwal
    Replies:
    3
    Views:
    10,392
    Gordon Beaton
    Jul 1, 2005
  4. Replies:
    0
    Views:
    2,863
  5. Qu0ll
    Replies:
    42
    Views:
    1,230
    Thufir Hawat
    Apr 13, 2009
Loading...

Share This Page