>>>>> J P Lewis writes:

> below is a program that has a bug - it doesn't create an array
> before assigning into it (happens in a constructor).

> Under 116v4a/glibc, the program says "Can't find class" rather than
> printing a nice stacktrace.  Under 115v5,7 it sometimes prints the
> stacktrace; sometimes the constructor returns null and no (correct)
> error is printed.

This is a known Sun bug in 1.1, it is fixed in 1.2b4.

Actually java should report something like:
shape constructor, initializing
Exception in thread "main" java.lang.ExceptionInInitializerError: 
java.lang.NullPointerException
        at bblobBUG.<clinit>(bblobBUG.java:48)


The bug can be reproduced very easy:
// Test.java
class C
{
    static Object[] objs;
    static {
        objs[0] = null;
    }
}
public class Test
{
    static C c = new C();
    public static void main(String[] args) {}
}



        Juergen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802

Reply via email to