>    I doubt the problem is Batik's sandboxing.  Unfortunately I
> don't know what the source of the problem is.  I think that getURL
> should work in an Applet without needing signing.  Can you get the
> security exception that is causing the problem?

SVG Error:
Wrapped org.mozilla.javascript.WrappedException: Wrapped
java.lang.NullPointerException (Inline <script>
http://localhost/folder/getURL.svg:7#7) (Event attribute
http://localhost/folder/getURL.svg:4 onload#1)

Environment:
OS - Windows XP SP3
Batik - 1.8pre (rev. 6751108)
Java - 1.6.0_06

Attached are both the test case used ("getURL.svg") and the stack
trace ("BatikGetURLException-StackTrace.txt", copied from "Show
Details") for the exception.

Other (failed) attempts which have been made (and why):
1. Separate the script declarations from the SVG file to a different
(.js) file: check if the Domain exception could be related with the
specific URI from which the script was loaded;
2. Tested in a different machine, using a different operating system
(Ubuntu 8.04): check if the Domain exception could be related with
localhost testing and if it was a Windows-specific issue. Got the same
exception (server name instead of "localhost", of course);
3. Several iterations of running with the "Applet Viewer", using a
custom policy ("-J-Djava.security.policy" argument) lead to understand
that the only required permission seems to be "createClassLoader"
(which is not good news anyway as it is one of the most dangerous to
grant [1]). Attached is the policy ("SvgViewer.policy") which causes
getURL to succeed.

@Bob Brown
Note: All seems to apply to parseXML also ("parseXML.svg" attachment),
which seems to succeed in the same situations. ;-)

I was able to make the exception go away by signing both the applet
and batik jars. Again, it would be awesome to get Batik pass over this
without requiring applet signing. Common Batik-based applets with
"AJAX" support could then be easily created, which would surely boost
Batik usage within the SVG community. :-)

Should these (and follow-ups to similar threads) be published
somewhere within the Wiki? Creating an "applet" page in the how-to [2]
section maybe...?

Best regards,

 Helder Magalhães

[1] http://java.sun.com/j2se/1.5.0/docs/guide/security/permissions.html
[2] http://wiki.apache.org/xmlgraphics-batik/HowTo

<<attachment: getURL.svg>>

<<attachment: parseXML.svg>>

org.mozilla.javascript.WrappedException: Wrapped 
org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException 
(Inline <script> http://localhost/folder/getURL.svg:7#7) (Event attribute 
http://localhost/folder/getURL.svg:4 onload#1)
        at 
org.apache.batik.script.rhino.BatikSecurityController.callWithDomain(Unknown 
Source)
        at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
        at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
        at script(Event attribute http://localhost/folder/getURL.svg:4 onload:1)
        at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
        at org.apache.batik.script.rhino.BatikSecurityController$1.run(Unknown 
Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.batik.script.rhino.BatikSecurityController.callWithDomain(Unknown 
Source)
        at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.exec(Unknown Source)
        at org.mozilla.javascript.Context.evaluateReader(Unknown Source)
        at org.apache.batik.script.rhino.RhinoInterpreter$2.run(Unknown Source)
        at org.mozilla.javascript.Context.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.call(Unknown Source)
        at org.apache.batik.script.rhino.RhinoInterpreter.evaluate(Unknown 
Source)
        at 
org.apache.batik.bridge.BaseScriptingEnvironment$1.handleEvent(Unknown Source)
        at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown 
Source)
        at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown 
Source)
        at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown 
Source)
        at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
        at 
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(Unknown Source)
        at 
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown 
Source)
        at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown 
Source)
        at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown 
Source)
        at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
Caused by: org.mozilla.javascript.WrappedException: Wrapped 
java.lang.NullPointerException (Inline <script> 
http://localhost/folder/getURL.svg:7#7)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
        at org.mozilla.javascript.MemberBox.invoke(Unknown Source)
        at org.mozilla.javascript.FunctionObject.call(Unknown Source)
        at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
        at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
        at org.apache.batik.script.rhino.BatikSecurityController$1.run(Unknown 
Source)
        at java.security.AccessController.doPrivileged(Native Method)
        ... 29 more
Caused by: java.lang.NullPointerException
        at 
org.apache.batik.script.rhino.RhinoInterpreter.getAccessControlContext(Unknown 
Source)
        at org.apache.batik.script.rhino.WindowWrapper.getURL(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        ... 36 more

Attachment: SvgViewer.policy
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to