diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 00d3a66979..3110c068c2 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -58,7 +58,7 @@ doOpen(JNIEnv* e, const char* path, int mask) { int fd = OPEN(path, mask | OPEN_MASK, S_IRUSR | S_IWUSR); if (fd == -1) { - throwNew(e, "java/lang/IOException", strerror(errno)); + throwNew(e, "java/io/IOException", strerror(errno)); } return fd; } @@ -68,7 +68,7 @@ doClose(JNIEnv* e, jint fd) { int r = CLOSE(fd); if (r == -1) { - throwNew(e, "java/lang/IOException", strerror(errno)); + throwNew(e, "java/io/IOException", strerror(errno)); } } @@ -81,7 +81,7 @@ doRead(JNIEnv* e, jint fd, jbyte* data, jint length) } else if (r == 0) { return -1; } else { - throwNew(e, "java/lang/IOException", strerror(errno)); + throwNew(e, "java/io/IOException", strerror(errno)); return 0; } } @@ -91,7 +91,7 @@ doWrite(JNIEnv* e, jint fd, const jbyte* data, jint length) { int r = WRITE(fd, data, length); if (r != length) { - throwNew(e, "java/lang/IOException", strerror(errno)); + throwNew(e, "java/io/IOException", strerror(errno)); } } @@ -128,7 +128,7 @@ Java_java_io_File_mkdir(JNIEnv* e, jclass, jstring path) if (not exists(chars)) { int r = ::MKDIR(chars, 0700); if (r != 0) { - throwNew(e, "java/lang/IOException", strerror(errno)); + throwNew(e, "java/io/IOException", strerror(errno)); } } e->ReleaseStringUTFChars(path, chars); @@ -143,7 +143,7 @@ Java_java_io_File_createNewFile(JNIEnv* e, jclass, jstring path) if (not exists(chars)) { int fd = CREAT(chars, 0600); if (fd == -1) { - throwNew(e, "java/lang/IOException", strerror(errno)); + throwNew(e, "java/io/IOException", strerror(errno)); } else { doClose(e, fd); } diff --git a/classpath/java/io/StringReader.java b/classpath/java/io/StringReader.java index f2e2b82424..d2b536af2c 100644 --- a/classpath/java/io/StringReader.java +++ b/classpath/java/io/StringReader.java @@ -16,6 +16,7 @@ public class StringReader extends Reader { } } in.getChars(position, length, b, offset); + position += length; return length; } diff --git a/classpath/java/lang/Throwable.java b/classpath/java/lang/Throwable.java index 50b79130e1..01e28fd6e7 100644 --- a/classpath/java/lang/Throwable.java +++ b/classpath/java/lang/Throwable.java @@ -35,6 +35,10 @@ public class Throwable { return message; } + public String toString() { + return getClass().getName() + ": " + message; + } + private static native Object trace(int skipCount); private static native StackTraceElement[] resolveTrace(Object trace); diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 8fee8bac87..4cc8aca274 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -95,6 +95,12 @@ ThrowNew(Thread* t, jclass c, const char* message) return 0; } +void +DeleteLocalRef(Thread*, jobject) +{ + // do nothing +} + jboolean ExceptionCheck(Thread* t) { @@ -119,6 +125,7 @@ populateJNITable(JNIEnvVTable* table) table->FindClass = ::FindClass; table->ThrowNew = ::ThrowNew; table->ExceptionCheck = ::ExceptionCheck; + table->DeleteLocalRef = ::DeleteLocalRef; } } // namespace vm diff --git a/src/machine.cpp b/src/machine.cpp index 89d237c3fd..6b38ff0ddf 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -1033,7 +1033,9 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool) set(t, classMethodTable(t, class_), methodTable); } - if (declaredVirtualCount == 0) { + if (declaredVirtualCount == 0 + and (classFlags(t, class_) & ACC_INTERFACE) == 0) + { // inherit interface table and virtual table from superclass set(t, classInterfaceTable(t, class_), diff --git a/src/run.cpp b/src/run.cpp index 1985cfb318..bb850ed53c 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -208,11 +208,14 @@ resolve(Thread* t, object pool, unsigned index, object class_ = resolveClass(t, o, referenceClass); if (UNLIKELY(t->exception)) return 0; + o = 0; if (classFlags(t, class_) & ACC_INTERFACE) { - o = ::find(t, classVirtualTable(t, class_), arrayBody(t, pool, index), - methodName, methodSpec); + if (classVirtualTable(t, class_)) { + o = ::find(t, classVirtualTable(t, class_), arrayBody(t, pool, index), + methodName, methodSpec); + } } else { - for (o = 0; o == 0 and class_; class_ = classSuper(t, class_)) { + for (; o == 0 and class_; class_ = classSuper(t, class_)) { o = find(t, class_, arrayBody(t, pool, index)); } }