libgcj/1906: difference between gcj and jdk for MessageFormat

paul@dawa.demon.co.uk paul@dawa.demon.co.uk
Wed Feb 7 14:16:00 GMT 2001


>Number:         1906
>Category:       libgcj
>Synopsis:       difference between gcj and jdk for MessageFormat
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 07 14:16:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     paul@dawa.demon.co.uk
>Release:        gcc version 2.97 20010206 (experimental)
>Organization:
>Environment:
Linux RedHat 7 x86
>Description:
The following code

import java.text.MessageFormat;

public class Test {
    public static void main(String args[]) {
        MessageFormat messageformat = new MessageFormat("test Message = {0}");

        Object aobj[] = new Object[1];
        aobj[0] = new String("a jolly string");
        System.out.println(messageformat.format((Object) aobj));
    }
}

produces different results when compiled with gcj than it
does if run in either Sun's (1.2) or IBM's (1.3) JDK

$ javac Test.java
$ java Test 
test Message a jolly string
$ gcj Test.java --main=Test -o test
$ ./test
test Message [Ljava.lang.Object;@807dfc0

>How-To-Repeat:

>Fix:
Presumably the Sun JDK has a(n undocumented) test in the
java.text.format(Object obj) method to see if the object
is really an array and behave differently if so.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list