1 package es.caib.signatura.impl;
2
3 import java.io.IOException;
4 import java.net.URL;
5 import java.net.URLClassLoader;
6 import java.net.URLStreamHandlerFactory;
7 import java.util.Enumeration;
8
9 import sun.misc.CompoundEnumeration;
10
11
12
13
14
15
16
17 public class ExclusiveURLClassLoader extends URLClassLoader {
18
19 public ExclusiveURLClassLoader(URL[] arg0) {
20 super(arg0);
21
22 }
23
24 public ExclusiveURLClassLoader(URL[] arg0, ClassLoader arg1) {
25 super(arg0, arg1);
26
27 }
28
29 public ExclusiveURLClassLoader(URL[] arg0, ClassLoader arg1,
30 URLStreamHandlerFactory arg2) {
31 super(arg0, arg1, arg2);
32
33 }
34
35
36
37
38
39
40
41
42 protected synchronized Class loadClass(String name, boolean resolve)
43 throws ClassNotFoundException {
44
45 try {
46 Class c = findLoadedClass(name);
47 if (c == null) {
48 try {
49 c = findClass(name);
50 } catch (ClassNotFoundException e) {
51
52 if (getParent() != null) {
53 c = getParent().loadClass(name);
54 } else {
55 c = ClassLoader.getSystemClassLoader().loadClass(name);
56 }
57
58 }
59 }
60 if (resolve) {
61 resolveClass(c);
62 }
63 return c;
64 } catch (RuntimeException t) {
65 t.printStackTrace(System.out);
66 throw t;
67 } catch (Error t) {
68 t.printStackTrace(System.out);
69 throw t;
70 } finally {
71 }
72 }
73
74 public URL getResource(String name) {
75 URL url;
76
77 url = findResource(name);
78
79 if (url == null) {
80 if (getParent() != null)
81 url = getParent().getResource(name);
82 else
83 url = ClassLoader.getSystemResource(name);
84 }
85 return url;
86 }
87
88
89
90
91
92
93
94
95
96
97
98
99
100 }