In the two loadFile methods in jde.util.DynamicClassLoader
InputStream.read() is assumed to read the entire contents of the
stream in one go. This is not necessarily true always and I've found
it to fail when reading classes from large jars. This causes
java.lang.ClassFormatErrors which you don't see because they are
suppressed in loadClass.

This can be fixed by calling read in a loop till all the bytes are
read, something like this:

    private static byte[] read (InputStream is, int size) throws IOException {
    int len = 0;
    byte [] b = new byte[size];
    try {
        while (true) {
            int n = is.read(b, len, size - len);
            if (n == -1 || n == 0) {
                if (len < size) {
                    // ignore
                }
                break;
            } else
                len += n;
        }
    } finally {
        try {
            is.close();
        } catch (IOException e) {} // ignore
    }        
    return b;
}

Suraj

Reply via email to