This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 162168 - Problems with Proguard obfuscator ( 4.2 ) related to converting '\u0000' ( see issue 161977 )
Summary: Problems with Proguard obfuscator ( 4.2 ) related to converting '\u0000' ( se...
Status: RESOLVED WONTFIX
Alias: None
Product: javame
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@mobility
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-07 19:46 UTC by silvioturrini
Modified: 2009-04-08 18:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description silvioturrini 2009-04-07 19:46:21 UTC
This bug is related to the one reported on issue 161977 related to converting escape chars into strings ( '\u0000' in 
my case ) which impact the obfuscator behaviour ( proguard 4.2 in Netbeans 6.5.1 ).
The escape char '\u0000' is shown as '\ufffd' by the debugger when analysing the MIDlet ( platform wtk 2.5.2 but others 
behave the same ). It turned out that the same code running as javaSE application would show the right value, so this 
is a problem with the mobile package.
We already discover that this happens only with newer versions of jdk ( jdk1.6.0_11, jdk1.6.0_12, jdk1.6.0_13 ) but NOT 
with older versions ( jdk1.6.0_3, jdk1.6.0_4 ), and it seemed related to the debugger only, because the real value
was proved to be '\u0000' as expected.

Unfortunately we also found that this problem somehow caused the obfuscator proguard 4.2, part of the NetBeans mobile 
package, to generate wrong code ( even using the new option: -microedition and various level of Obfuscation ).
By running the same example which failed before on also NetBens 6.7 (M3), with a previous jdk ( jdk1.6.0_3 instead of 
the default one jdk1.6.0_13 ) the generated code was OK.
So the problem seems related to the java compiler ( earlier version works! ) and not onlyto the debugger.
Comment 1 Petr Suchomel 2009-04-08 11:02:52 UTC
Btw, have you tried to use ProGuard 4.3? Could you test it for me please?
Comment 2 Petr Suchomel 2009-04-08 18:24:10 UTC
Unfortunately this is bug in ProGuard. We did intensive investigation, and it is connected with security fix in JDK6u11
(UTF8 handling), issue 486841, the problem is wrong handling of UTF constants in constant pool in ProGuard
Utf8Constants.java.
See also Java VM spec, paragraph 4.4.7 http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#7963
Test case you can try to run on JDK6_u10 and then on JDK6_u11+:
public class TestUTFIssue {
    public static void main(String[] args) throws UnsupportedEncodingException {
        byte[] data = new byte[]{(byte)0xc0,(byte)0x80,(byte)0xc0,(byte)0x80};
        String s = new String(data, "UTF-8");
        for (int i=0;i<s.length();i++) {
            System.out.println(Integer.toHexString(s.charAt(i)));
        }
    }
}