81b4415d4474e075d3094d6420e0322bf3104abe
[jalviewjs.git] / site / j2s / org / xml / sax / helpers / NewInstance.js
1 Clazz.declarePackage ("org.xml.sax.helpers");
2 Clazz.load (null, "org.xml.sax.helpers.NewInstance", ["java.lang.Thread", "$.UnknownError"], function () {
3 c$ = Clazz.declareType (org.xml.sax.helpers, "NewInstance");
4 c$.newInstance = Clazz.defineMethod (c$, "newInstance", 
5 function (classLoader, className) {
6 var driverClass;
7 if (classLoader == null) {
8 driverClass = Clazz._4Name (className);
9 } else {
10 driverClass = classLoader.loadClass (className);
11 }return driverClass.newInstance ();
12 }, "ClassLoader,~S");
13 c$.getClassLoader = Clazz.defineMethod (c$, "getClassLoader", 
14 function () {
15 var m = null;
16 try {
17 m = Thread.getMethod ("getContextClassLoader", null);
18 } catch (e) {
19 if (Clazz.exceptionOf (e, NoSuchMethodException)) {
20 return org.xml.sax.helpers.NewInstance.getClassLoader ();
21 } else {
22 throw e;
23 }
24 }
25 try {
26 return m.invoke (Thread.currentThread (), null);
27 } catch (e$$) {
28 if (Clazz.exceptionOf (e$$, IllegalAccessException)) {
29 var e = e$$;
30 {
31 throw  new UnknownError (e.getMessage ());
32 }
33 } else if (Clazz.exceptionOf (e$$, java.lang.reflect.InvocationTargetException)) {
34 var e = e$$;
35 {
36 throw  new UnknownError (e.getMessage ());
37 }
38 } else {
39 throw e$$;
40 }
41 }
42 });
43 });