// 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) {
// Run the script handler.
ScriptHandler h;
h = (ScriptHandler)cll.loadClass(sh).newInstance();
if (window == null) {
window = createWindow();
}
h.run(document, window);
}
sh = man.getMainAttributes().getValue("SVG-Handler-Class");
if (sh != null) {
// Run the initializer
EventListenerInitializer initializer;
initializer =
(EventListenerInitializer)cll.loadClass(sh).newInstance();
if (window == null) {
window = createWindow();
}
initializer.initializeEventListeners((SVGDocument)document);
}
} catch (Exception e) {
if (userAgent != null) {
userAgent.displayError(e);
}
}
continue;
}
//
// Scripting language invocation.
//
Interpreter interpreter = getInterpreter(type);
if (interpreter == null)
// Can't find interpreter so just skip this script block.
continue;
try {
String href = XLinkSupport.getXLinkHref(script);
String desc = null;
Reader reader;
if (href.length() > 0) {
desc = href;
// External script.
ParsedURL purl = new ParsedURL
(XMLBaseSupport.getCascadedXMLBase(script), href);
checkCompatibleScriptURL(type, purl);
reader = new InputStreamReader(purl.openStream());
} else {
checkCompatibleScriptURL(type, docPURL);
DocumentLoader dl = bridgeContext.getDocumentLoader();
Element e = script;
SVGDocument d = (SVGDocument)e.getOwnerDocument();