// Java code invocation.
//
if (type.equals(SVGConstants.SVG_SCRIPT_TYPE_JAVA)) {
try {
String href = XLinkSupport.getXLinkHref(script);
ParsedURL purl = new ParsedURL
(XMLBaseSupport.getCascadedXMLBase(script), href);
checkCompatibleScriptURL(type, purl);
DocumentJarClassLoader cll;
URL docURL = null;
try {
docURL = new URL(docPURL.toString());
} catch (MalformedURLException mue) {
/* nothing just let docURL be null */
}
cll = new DocumentJarClassLoader
(new URL(purl.toString()), docURL);
// Get the 'Script-Handler' entry in the manifest.
URL url = cll.findResource("META-INF/MANIFEST.MF");
if (url == null) {
continue;
}
Manifest man = new Manifest(url.openStream());
String sh;
sh = man.getMainAttributes().getValue("Script-Handler");
if (sh == null) {
continue;
}
// Run the script handler.
ScriptHandler h;
h = (ScriptHandler)cll.loadClass(sh).newInstance();
if (window == null) {
window = createWindow();
}
h.run(document, window);
} catch (Exception e) {
if (userAgent != null) {
userAgent.displayError(e);
}
}
continue;
}
//
// Scripting language invocation.
//
Interpreter interpreter = bridgeContext.getInterpreter(type);
if (interpreter == null) {
UserAgent ua = bridgeContext.getUserAgent();
if (ua != null) {
ua.displayError(new Exception("Unknown language: "+type));
}
return;
}
if (!languages.contains(type)) {
languages.add(type);
initializeEnvironment(interpreter, type);
}
try {
String href = XLinkSupport.getXLinkHref(script);
Reader reader;
if (href.length() > 0) {
// External script.
ParsedURL purl = new ParsedURL
(XMLBaseSupport.getCascadedXMLBase(script), href);
checkCompatibleScriptURL(type, purl);
reader = new InputStreamReader(purl.openStream());
} else {
// Inline script.
Node n = script.getFirstChild();
if (n != null) {
StringBuffer sb = new StringBuffer();