Lines 15-20
Link Here
|
15 |
import java.io.*; |
15 |
import java.io.*; |
16 |
import java.net.*; |
16 |
import java.net.*; |
17 |
import java.util.*; |
17 |
import java.util.*; |
|
|
18 |
import org.openide.modules.InstalledFileLocator; |
18 |
|
19 |
|
19 |
/** |
20 |
/** |
20 |
* A filtering classloader (isolator) ensuring that a particuler version of |
21 |
* A filtering classloader (isolator) ensuring that a particuler version of |
Lines 40-46
Link Here
|
40 |
// parser library relative to module directory |
41 |
// parser library relative to module directory |
41 |
// library itself can not have a jar extension |
42 |
// library itself can not have a jar extension |
42 |
// to avoid loading it by module classloader |
43 |
// to avoid loading it by module classloader |
43 |
private static final String PARSER_MODULES_LIB = "/modules/autoload/ext/xerces2.jar"; // NOI18N |
44 |
private static final String PARSER_MODULES_LIB = "modules/autoload/ext/xerces2.jar"; // NOI18N |
44 |
|
45 |
|
45 |
// delegating classloader |
46 |
// delegating classloader |
46 |
private ClassLoader parentLoader; |
47 |
private ClassLoader parentLoader; |
Lines 49-56
Link Here
|
49 |
private static ParserLoader instance = null; |
50 |
private static ParserLoader instance = null; |
50 |
|
51 |
|
51 |
/** Creates new ParserLoader */ |
52 |
/** Creates new ParserLoader */ |
52 |
private ParserLoader(URL library) { |
53 |
private ParserLoader(URL[] libraries) { |
53 |
super(new URL[] { library }); |
54 |
super(libraries); |
54 |
parentLoader = org.openide.TopManager.getDefault().systemClassLoader();//getClass().getClassLoader(); |
55 |
parentLoader = org.openide.TopManager.getDefault().systemClassLoader();//getClass().getClassLoader(); |
55 |
} |
56 |
} |
56 |
|
57 |
|
Lines 63-91
Link Here
|
63 |
if (instance != null) return instance; |
64 |
if (instance != null) return instance; |
64 |
|
65 |
|
65 |
try { |
66 |
try { |
66 |
String prop; |
|
|
67 |
URL xer2url; |
68 |
|
69 |
prop = System.getProperty("netbeans.user"); // NOI18N |
70 |
xer2url = new URL("file:" + prop + PARSER_MODULES_LIB); // NOI18N |
71 |
|
72 |
try { |
73 |
// just skip netbeans home |
74 |
xer2url.openStream(); |
75 |
} catch (IOException ex) { |
76 |
prop = System.getProperty("netbeans.home"); // NOI18N |
77 |
xer2url = new URL("file:" + prop + PARSER_MODULES_LIB); // NOI18N |
78 |
} |
79 |
|
80 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("Isolated jar URL=" + xer2url); // NOI18N |
81 |
|
82 |
instance = new ParserLoader(xer2url); |
83 |
// URL module = instance.getClass().getProtectionDomain().getCodeSource().getLocation(); |
67 |
// URL module = instance.getClass().getProtectionDomain().getCodeSource().getLocation(); |
|
|
68 |
// Could also use InstalledFileLocator here, but this should suffice: |
84 |
URL module = org.netbeans.tax.io.XNIBuilder.class.getProtectionDomain().getCodeSource().getLocation(); |
69 |
URL module = org.netbeans.tax.io.XNIBuilder.class.getProtectionDomain().getCodeSource().getLocation(); |
85 |
|
70 |
|
86 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("Isolated module URL=" + module); // NOI18N |
71 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("Isolated module URL=" + module); // NOI18N |
87 |
|
72 |
|
88 |
instance.addURL(module); |
73 |
URL xer2url = InstalledFileLocator.getDefault().locate(PARSER_MODULES_LIB, "org.netbeans.modules.xml.tax", false).toURL(); // NOI18N |
|
|
74 |
|
75 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("Isolated jar URL=" + xer2url); // NOI18N |
76 |
|
77 |
instance = new ParserLoader(new URL[] {xer2url, module}); |
89 |
} catch (MalformedURLException ex) { |
78 |
} catch (MalformedURLException ex) { |
90 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug (ex); |
79 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug (ex); |
91 |
} |
80 |
} |