[kaffe] missing ArrayIndexOutOfBoundsException in defineClass

Christian Thalinger twisti at complang.tuwien.ac.at
Sun Apr 3 11:08:37 PDT 2005


While testing and implementing CACAO's defineClass, if found this issue:

$ cat MyClassLoader.java
import java.io.*;

public class MyClassLoader extends ClassLoader {
    public static void main(String[] argv) throws Exception {
        new MyClassLoader();
    }

    public MyClassLoader() throws Exception {
        File f = new File("MyClassLoader.class");
        FileInputStream fis = new FileInputStream(f);

        byte[] ba = new byte[(int) f.length()];
        fis.read(ba);

        Class c = defineClass(null, ba, 0, -1, null);

        System.out.println(c);
    }
}

$ cacao MyClassLoader
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
        <<No stacktrace available>>
$ kaffe MyClassLoader
class MyClassLoader






More information about the kaffe mailing list