From 6c413a50e664e75c77f94aa1f441c1f876084140 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Sun, 17 Oct 1999 03:11:50 +0000 Subject: [PATCH] ClassLoader.java (getSystemResource): Use getSystemClassLoader instead of ClassLoader.system. * java/lang/ClassLoader.java (getSystemResource): Use getSystemClassLoader instead of ClassLoader.system. (getSystemResourceAsStream): Ditto. * java/lang/natClassLoader.cc (redirect): Make static and remove #ifdef INTERPRETER so it is always defined. (getVMClassLoader0): Remove #ifdef INTERPRETER so it always returns a VMClassLoader. * java/util/ResourceBundle.java (trySomeGetBundle): Create a PropertyResourceBundle if a properties file is found before a ResourceBundle class. From-SVN: r30048 --- libjava/ChangeLog | 15 +++++++++++++++ libjava/java/lang/ClassLoader.java | 4 ++-- libjava/java/lang/natClassLoader.cc | 14 ++++---------- libjava/java/util/ResourceBundle.java | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4f37d8a66f2..0e6761c11ae 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,18 @@ +1999-10-16 Anthony Green + + * java/lang/ClassLoader.java (getSystemResource): Use + getSystemClassLoader instead of ClassLoader.system. + (getSystemResourceAsStream): Ditto. + + * java/lang/natClassLoader.cc (redirect): Make static and + remove #ifdef INTERPRETER so it is always defined. + (getVMClassLoader0): Remove #ifdef INTERPRETER so it always + returns a VMClassLoader. + + * java/util/ResourceBundle.java (trySomeGetBundle): Create a + PropertyResourceBundle if a properties file is found before a + ResourceBundle class. + 1999-10-15 Tom Tromey * gij.cc (main): Formatting fixes. diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java index 4d520bb6c19..f04868d94e6 100644 --- a/libjava/java/lang/ClassLoader.java +++ b/libjava/java/lang/ClassLoader.java @@ -360,11 +360,11 @@ public abstract class ClassLoader { protected native Class findLoadedClass(String name); public static final InputStream getSystemResourceAsStream(String name) { - return system.getResourceAsStream (name); + return getSystemClassLoader().getResourceAsStream (name); } public static final URL getSystemResource(String name) { - return system.getResource (name); + return getSystemClassLoader().getResource (name); } /** diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index 9ad81a81a37..af4a4fab632 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -48,20 +48,14 @@ extern java::lang::Class ClassLoaderClass; /////////// java.lang.ClassLoader native methods //////////// -#ifdef INTERPRETER -gnu::gcj::runtime::VMClassLoader *redirect = 0; -#endif +static gnu::gcj::runtime::VMClassLoader *redirect = 0; java::lang::ClassLoader* java::lang::ClassLoader::getVMClassLoader0 () { -#ifdef INTERPRETER - if (redirect == 0) - redirect = new gnu::gcj::runtime::VMClassLoader; - return redirect; -#else - return 0; -#endif + if (redirect == 0) + redirect = new gnu::gcj::runtime::VMClassLoader; + return redirect; } void diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java index 5a2002aabb6..0c078cc1ee7 100644 --- a/libjava/java/util/ResourceBundle.java +++ b/libjava/java/util/ResourceBundle.java @@ -8,6 +8,8 @@ details. */ package java.util; +import java.io.InputStream; + /** * @author Anthony Green * @date November 26, 1998. @@ -106,6 +108,23 @@ public abstract class ResourceBundle // Fall through. } + // Look for a properties file. + { + InputStream i = + ClassLoader.getSystemResourceAsStream (bundleName.replace ('.', '/') + + ".properties"); + if (i != null) + { + try { + return new PropertyResourceBundle (i); + } catch (java.io.IOException e) { + // The docs don't appear to define what happens in + // this case, but it seems like continuing the + // search is a reasonable thing to do. + } + } + } + if (bundleName.equals(stopHere)) return result; else