emul/mini/src/main/java/java/lang/ClassLoader.java
changeset 771 4252bfc396fc
parent 554 05224402145d
     1.1 --- a/emul/mini/src/main/java/java/lang/ClassLoader.java	Wed Jan 23 20:39:23 2013 +0100
     1.2 +++ b/emul/mini/src/main/java/java/lang/ClassLoader.java	Tue Feb 26 14:55:55 2013 +0100
     1.3 @@ -703,7 +703,7 @@
     1.4      public static Enumeration<URL> getSystemResources(String name)
     1.5          throws IOException
     1.6      {
     1.7 -        ClassLoader system = getSystemClassLoader();
     1.8 +        ClassLoader system = null; // getSystemClassLoader();
     1.9          if (system == null) {
    1.10              return getBootstrapResources(name);
    1.11          }
    1.12 @@ -874,7 +874,29 @@
    1.13      }
    1.14  
    1.15      private static Enumeration<URL> getBootstrapResources(String name) {
    1.16 -        throw new UnsupportedOperationException();
    1.17 +        URL u = Object.class.getResource("/" + name);
    1.18 +        return new OneOrZeroEnum(u);
    1.19 +    }
    1.20 +    
    1.21 +    private static class OneOrZeroEnum implements Enumeration<URL> {
    1.22 +        private URL u;
    1.23 +
    1.24 +        public OneOrZeroEnum(URL u) {
    1.25 +            this.u = u;
    1.26 +        }
    1.27 +
    1.28 +        public boolean hasMoreElements() {
    1.29 +            return u != null;
    1.30 +        }
    1.31 +
    1.32 +        public URL nextElement() {
    1.33 +            URL r = u;
    1.34 +            if (r == null) {
    1.35 +                throw new NoSuchElementException();
    1.36 +            }
    1.37 +            u = null;
    1.38 +            return r;
    1.39 +        }
    1.40      }
    1.41  
    1.42      private static class CompoundEnumeration implements Enumeration<URL> {