From bb520e4ef974ebe90232f1567447e67f9fcdf0e5 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 13 Sep 2007 21:59:39 -0600 Subject: [PATCH] bugfixes --- classpath/java/lang/Class.java | 21 ++++++++++++++++++--- classpath/java/util/ResourceBundle.java | 12 +++++++++--- makefile | 2 +- src/run.cpp | 6 +++--- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/classpath/java/lang/Class.java b/classpath/java/lang/Class.java index 918ffb85d2..e0d46ddd99 100644 --- a/classpath/java/lang/Class.java +++ b/classpath/java/lang/Class.java @@ -6,6 +6,8 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.lang.reflect.InvocationTargetException; import java.io.InputStream; +import java.io.IOException; +import java.net.URL; public final class Class { private static final int PrimitiveFlag = 1 << 4; @@ -367,10 +369,23 @@ public final class Class { return (vmFlags & PrimitiveFlag) != 0; } - public InputStream getResourceAsStream(String path) { + public URL getResource(String path) { if (! path.startsWith("/")) { - path = new String(name, 0, name.length - 1, false) + "/" + path; + String name = new String(this.name, 0, this.name.length - 1, false); + int index = name.lastIndexOf('/'); + if (index >= 0) { + path = name.substring(0, index) + "/" + path; + } + } + return getClassLoader().getResource(path); + } + + public InputStream getResourceAsStream(String path) { + URL url = getResource(path); + try { + return (url == null ? null : url.openStream()); + } catch (IOException e) { + return null; } - return getClassLoader().getResourceAsStream(path); } } diff --git a/classpath/java/util/ResourceBundle.java b/classpath/java/util/ResourceBundle.java index 6df7e4d3a0..3c3bb694a4 100644 --- a/classpath/java/util/ResourceBundle.java +++ b/classpath/java/util/ResourceBundle.java @@ -53,15 +53,21 @@ public abstract class ResourceBundle { { try { ResourceBundle b = find(name, loader, null); + if (locale.getLanguage() != null) { name = name + "_" + locale.getLanguage(); - b = find(name, loader, b); + ResourceBundle b2 = find(name, loader, b); + if (b2 != null) b = b2; + if (locale.getCountry() != null) { name = name + "_" + locale.getCountry(); - b = find(name, loader, b); + b2 = find(name, loader, b); + if (b2 != null) b = b2; + if (locale.getVariant() != null) { name = name + "_" + locale.getVariant(); - b = find(name, loader, b); + b2 = find(name, loader, b); + if (b2 != null) b = b2; } } } diff --git a/makefile b/makefile index 194aeb050d..a92670ca57 100644 --- a/makefile +++ b/makefile @@ -144,7 +144,7 @@ jscheme-command = jscheme/REPL build/make.scm -main commandMain "" swt-command = $(call class-name,$(swt-input)) .PHONY: build -build: $(executable) +build: $(executable) $(classpath-objects) $(input): $(classpath-objects) $(swt-input): $(classpath-objects) diff --git a/src/run.cpp b/src/run.cpp index 933690243f..e63d566664 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -1977,14 +1977,14 @@ run(Thread* t) } goto loop; case lshl: { - int64_t b = popLong(t); + int32_t b = popInt(t); int64_t a = popLong(t); pushLong(t, a << b); } goto loop; case lshr: { - int64_t b = popLong(t); + int32_t b = popInt(t); int64_t a = popLong(t); pushLong(t, a >> b); @@ -2700,7 +2700,7 @@ run(Thread* t, object method, object this_, ...) va_list a; va_start(a, this_); - object r = run(t, method, this_, false, a); + object r = runv(t, method, this_, false, a); va_end(a);