equal
deleted
inserted
replaced
42 * |
42 * |
43 * - Loader.java (a 1.1 style class loader) |
43 * - Loader.java (a 1.1 style class loader) |
44 * - Loadee.java (source for a class that refers to Loader) |
44 * - Loadee.java (source for a class that refers to Loader) |
45 * - Loadee.classfile (to test findSystemClass) |
45 * - Loadee.classfile (to test findSystemClass) |
46 * - Loadee.resource (to test getSystemResource) |
46 * - Loadee.resource (to test getSystemResource) |
47 * - java/lang/Object.class (to test getSystemResources) |
|
48 * |
47 * |
49 * The extension ".classfile" is so the class file is not seen by any loader |
48 * The extension ".classfile" is so the class file is not seen by any loader |
50 * other than Loader. If you need to make any changes you will have to |
49 * other than Loader. If you need to make any changes you will have to |
51 * compile Loadee.java and rename Loadee.class to Loadee.classfile. |
50 * compile Loadee.java and rename Loadee.class to Loadee.classfile. |
52 */ |
51 */ |
125 URL u = getSystemResource("Loadee.resource"); |
124 URL u = getSystemResource("Loadee.resource"); |
126 if (u == null) |
125 if (u == null) |
127 throw new Exception |
126 throw new Exception |
128 ("java.lang.ClassLoader.getSystemResource() test failed!"); |
127 ("java.lang.ClassLoader.getSystemResource() test failed!"); |
129 } |
128 } |
130 |
|
131 if ((tests & RESOURCES) == RESOURCES) { |
|
132 report("getSystemResources()"); |
|
133 java.util.Enumeration e = |
|
134 getSystemResources("java/lang/Object.class"); |
|
135 HashSet hs = new HashSet(); |
|
136 while (e.hasMoreElements()) { |
|
137 URL u = (URL)e.nextElement(); |
|
138 if (u == null) |
|
139 break; |
|
140 System.out.println("url: " + u); |
|
141 hs.add(u); |
|
142 } |
|
143 if (hs.size() != 2) { |
|
144 throw |
|
145 new Exception("java.lang.ClassLoader.getSystemResources()"+ |
|
146 " did not find all resources"); |
|
147 } |
|
148 } |
|
149 } |
129 } |
150 |
130 |
151 private static void report(String s) { |
131 private static void report(String s) { |
152 System.out.println("Testing java.lang.ClassLoader." + s + " ..."); |
132 System.out.println("Testing java.lang.ClassLoader." + s + " ..."); |
153 } |
133 } |