Hi,
I'm working on a SVG editor at the moment.
I have some trouble creating a new Document. I followed the guidelines on the Batik
about the DOM tree and use the following method for creating a new document:
>> public Document createNewDocument(String width,
>> String height) {
>> DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
>> String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
>> Document doc = impl.createDocument(svgNS, "svg", null);
>>
>> Element svgRoot = doc.getDocumentElement();
>>
>> svgRoot.setAttributeNS(null, "width", width);
>> svgRoot.setAttributeNS(null, "height", height);
>>
>> return doc;
>> }
Now when i trie to run the app I get the following exception:
>> [java] java.lang.NullPointerException
>> [java] at java.net.URLClassLoader.getPermissions(URLClassLoader.java:418)
>> [java] at
>org.apache.batik.script.rhino.RhinoClassLoader.getPermissions(Unknown Source)
>> [java] at org.apache.batik.script.rhino.RhinoClassLoader.<init>(Unknown
>Source)
>> [java] at org.apache.batik.script.rhino.RhinoInterpreter.<init>(Unknown
>Source)
>> [java] at
>org.apache.batik.script.rhino.RhinoInterpreterFactory.createInterpreter(Unknown
>Source)
>> [java] at org.apache.batik.script.InterpreterPool.createInterpreter(Unknown
>Source)
>> [java] at org.apache.batik.bridge.BridgeContext.getInterpreter(Unknown
>Source)
>> [java] at
>org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown Source)
>> [java] at
>org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
>> [java] at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown
>Source)
I also get the following error:
>> SVG Error:
>> Unknown language: text/ecmascript
I tried to find the problem myself, and I think I fixed the problem.. At least, it
works
for me this way without errors or exceptions. In the constructor of the
org.apache.batik.script.rhino.RhinoClassLoader I placed the two statements that set the
rhinoProtectionDomain and the rhinoAccessControlContext within the
if (documentURL != null) statement.
Here's my CVS diff:
>> Index: RhinoClassLoader.java
>> ===================================================================
>> RCS file:
>/home/cvspublic/xml-batik/sources/org/apache/batik/script/rhino/RhinoClassLoader.java,v
>> retrieving revision 1.2
>> diff -u -3 -p -b -r1.2 RhinoClassLoader.java
>> --- RhinoClassLoader.java 14 May 2002 08:57:32 -0000 1.2
>> +++ RhinoClassLoader.java 22 May 2002 14:14:40 -0000
>> @@ -64,7 +64,6 @@ public class RhinoClassLoader extends UR
>> this.documentURL = documentURL;
>> if (documentURL != null){
>> codeSource = new CodeSource(documentURL, null);
>> - }
>>
>> //
>> // Create the Rhino ProtectionDomain
>> @@ -77,6 +76,7 @@ public class RhinoClassLoader extends UR
>> rhinoAccessControlContext
>> = new AccessControlContext(new ProtectionDomain[]{
>> rhinoProtectionDomain});
>> + }
>> }
>>
>> /**
Greets,
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]