1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
package org.xml.sax.helpers; |
9 |
|
|
10 |
|
import java.lang.reflect.Method; |
11 |
|
import java.lang.reflect.InvocationTargetException; |
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@author |
32 |
|
@version |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0.46 |
|
34 |
|
class NewInstance { |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
41 |
0 |
static Object newInstance (ClassLoader classLoader, String className)... |
42 |
|
throws ClassNotFoundException, IllegalAccessException, |
43 |
|
InstantiationException |
44 |
|
{ |
45 |
0 |
Class driverClass; |
46 |
0 |
if (classLoader == null) { |
47 |
0 |
driverClass = Class.forName(className); |
48 |
|
} else { |
49 |
0 |
driverClass = classLoader.loadClass(className); |
50 |
|
} |
51 |
0 |
return driverClass.newInstance(); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 4 |
Complexity Density: 0.5 |
|
58 |
0 |
static ClassLoader getClassLoader ()... |
59 |
|
{ |
60 |
0 |
Method m = null; |
61 |
|
|
62 |
0 |
try { |
63 |
0 |
m = Thread.class.getMethod("getContextClassLoader", null); |
64 |
|
} catch (NoSuchMethodException e) { |
65 |
|
|
66 |
0 |
return NewInstance.class.getClassLoader(); |
67 |
|
} |
68 |
|
|
69 |
0 |
try { |
70 |
0 |
return (ClassLoader) m.invoke(Thread.currentThread(), null); |
71 |
|
} catch (IllegalAccessException e) { |
72 |
|
|
73 |
0 |
throw new UnknownError(e.getMessage()); |
74 |
|
} catch (InvocationTargetException e) { |
75 |
|
|
76 |
0 |
throw new UnknownError(e.getMessage()); |
77 |
|
} |
78 |
|
} |
79 |
|
} |