In looking at InputEntity.java in the the xml-crimson code, it looks
like the resource is being classed as an invalid URL and the code
attempts to convert it into a file reference. I'm not really sure why
this would work differently in an applet than in an application.

More importantly, I have no idea how to convince the code to "do the
right thing" at this point, or possibly where the system id is set
up... I guess I could follow that track a little ways.

"G. Wade Johnson" wrote:
> 
> I'm willing to keep looking at it, if you think there's a possibility
> of finding it. I'll see what I can find out.
> 
> I've extracted the inner exception. The stack trace is below:
> (apologies for any typoes)
> 
> java.security.AccessControlException: access denied (java.util.PropertyPermission 
> user.dir read)
>         at 
> java.security.AccessControlContext.checkPermission(accessControlContext.java:270)
>         at java,security.AccessController.checkPermission(AccessController.java:401)
>         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
>         at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1291)
>         at java.lang.System.getProperty(System.java:572)
>         at java.io.Win32FileSystem.getUserPath(Win32FileSystem.java:272)
>         at java.io.Win32FileSystem.resolve(Win32FileSystem.java:288)
>         at java.io.File.getAbsolutePath(File.java:459)
>         at 
> org.apache.crimson.parser.InputEntity.convertToFileURL(InputEntity.java:168)
>         at org.apache.crimson.parser.InputEntity.init(InputEntity.java:204)

  [snip]

>         at 
> org.apache.batik.swing.svg.SVGDocumentLoader.run(SVGDocumentLoader.java:71)
> 
> Now, I'm not an expert. But, it sort of looks like crimson's
> convertToFileURL() is the culprit. I guess I can dig a little further.
> 
> G. Wade
> 
> Thomas E Deweese wrote:
> >
> > >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes:
> >
> > GWJ> Well...this at least generated a different exception.
> > GWJ> java.io.IOException: access denied (java.util.PropertyPermission
> > GWJ> user.dir read) at
> > GWJ> 
> > org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:355)
> > GWJ> ...
> >
> >      This looks to be another wrapped exception, so you would need to
> > figure out where it's really comming from.  The good thing is that
> > this appears to have gotten past the locating of the DTD.  However I
> > don't know who would be looking for the users's home directory.
> >
> > GWJ> Thanks for the help so far.
> >
> > GWJ> I may need to either post-process my incoming SVG to remove the
> > GWJ> DOCTYPE or try the suggestion from others of putting the
> > GWJ> libraries on my server as well.
> >
> >      Ok, but I think you are close to solving the issues here.
> >
> > GWJ> I'll look at the other options.
> >
> > GWJ> G. Wade
> >
> > GWJ> Thomas E Deweese wrote:
> > >>  >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes:
> > >>
> > GWJ> Yes.
> > >>  Hmm, very odd, I am unfortunately out of ideas. I haven't done
> > >> much with Applets. I am fairly certain that this is a permissions
> > >> problem however....
> > >>
> > >> Ahh, I have it! The doPriviliged did the trick but the InputStream
> > >> ends up trying to open the URL which points into the JRE, and it
> > >> must be doing it outside the doPrivileged block, so if fails...
> > >>
> > >> Can you try calling getResourceAsStream()? This should avoid the
> > >> issue.
> > >>
> > GWJ> Thomas E Deweese wrote:
> > >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> writes:
> > >> >>
> > GWJ> I tried the doPrivileged() thing as you suggested. I get an
> > GWJ> access denied error instead of a NPE, now.
> > >> >> Are you doing the doPrivileged in the SAXSVGDocumentFactory?
> > >> >>
> > GWJ> java.io.Exception: access denied (java.io.FilePermission
> > GWJ> \C:\Program Files\Java\j2re1.4.1_01\lib\ext\batik-svg-dom.jar
> > GWJ> read)
> > >> >>
> > GWJ> Thomas E Deweese wrote:
> > >> >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]>
> > >> writes:
> > >> >> >>
> > GWJ> Thomas E Deweese wrote:
> > >> >> >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]> >>
> > >> writes:
> > >> >> >> >>
> > GWJ> Thanks for the quick response.
> > >> >> >> >>
> > GWJ> I'm a little confused. I have installed the Batik libraries in
> > GWJ> the JRE extension directory. They appear to be being loaded from
> > GWJ> there. Wouldn't the DTD be in those JAR files or am I goofing
> > GWJ> something up?
> > >> >> >> >> Hmm, this is an odd setup, it is very possible that you
> > >> can't >> >> >> access resources from JAR's in the JRE extension
> > >> directory >> from >> >> your Applet's context.  What type of
> > >> exception does line >> 311 >> >> generate - a security excpetion?
> > >> >> >>
> > GWJ> <grin>It wouldn't be the first time I've been called
> > GWJ> "odd".</grin> My applet is going to be deployed to known client
> > GWJ> machines, so I can depend on having the libraries installed. The
> > GWJ> download for the whole library set was a concern for those who
> > GWJ> pay my check.<shrug/>
> > >> >> >>
> > GWJ> It's a NullPointerException all the way down.
> > >> >> >> Hmm, I think something is gobling the Security exception.  I
> > >> >> would >> try
> > >> >> >>
> > GWJ> I'm showing that the localSystemId is "resources/svg10.dtd". That
> > GWJ> exception appears to be caused by a NPE at
> > GWJ> org.apache.crimson.parser.Parser2.parseInternal( Parser2.java:524
> > GWJ> )
> > >> >> >>
> > GWJ> The failure (on line 311) appears to be the
> > GWJ> getResource(localSystemId) call returning a null.
> > >> >> >>
> > GWJ> I'm guessing I could include "resources/svg10.dtd" in my JAR and
> > GWJ> the problem would go away? It just seems awkward to have that
> > GWJ> resource in two places.
> > >> >> >>
> > GWJ> Does that sound like a viable attack?
> > >> >> >> You can try it, but I don't think this will fix it - your Jar
> > >> >> >> isn't on the SystemClassLoader's path so I don't think it
> > >> would >> >> find it.  I think you need to do the doPrivileged
> > >> thing.
> > >> >> >>
> > GWJ> G. Wade
> > >> >> >>
> > >> >> >> >>
> > >> >> >> >>
> > >> >> >> >> A potential quick fix would be to wrap the request for the
> > >> >> >> resource >> (on line 311) with a >> >>
> > >> java.security.AccessController.doPrivileged >> call.
> > >> >> >> >>
> > >> >> >> >> ----
> > >> >> >> >>
> > GWJ> Maybe I'm using a problematic DOCTYPE?
> > >> >> >> >>
> > GWJ> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
> > GWJ> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>
> > >> >> >> >>
> > GWJ> Another program is generating the SVG for my app and embeds this
> > GWJ> during creation.
> > >> >> >> >>
> > GWJ> I'll debug line 311 further to see what I find out.
> > >> >> >> >>
> > GWJ> Thanks again, G. Wade
> > >> >> >> >>
> > GWJ> Thomas E Deweese wrote:
> > >> >> >> >> >> >>>>> "GWJ" == G Wade Johnson <[EMAIL PROTECTED]>
> > >> >> >> writes:
> > >> >> >> >> >>
> > GWJ> I recently ran into a problem with NullPointExceptions when I
> > GWJ> tried to deploy the applet as a JAR file. I found that the
> > GWJ> application would run either way but the applet would only run as
> > GWJ> separate class files. More importantly, neither applet approach
> > GWJ> worked when the applet was served from a Tomcat server. (my
> > GWJ> production environment.)
> > >> >> >> >> >>
> > GWJ> I got the latest CVS version (this morning) and verified that it
> > GWJ> still exhibited the same behavior. I compiled with debugging on
> > GWJ> and optimization off. Using that version of the Batik jars, I was
> > GWJ> able to track the exception to
> > >> >> >> >> >>
> > GWJ> 
> > org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:353)
> > >> >> >> >> >>
> > GWJ> I added some further debugging code and tracked that exception to
> > >> >> >> >> >>
> > GWJ> 
> > org.apache.batik.dom.svgSAXSVGDocumentFactory.resolveEntity(SAXSVGDocumentFactory.java:311)
> > >> >> >> >> >> It seems that your JAR file is missing the SVG DTD that
> > >> >> >> should >> be >> bundled with Batik.  Are you bundling all the
> > >> stuff >> >> from: >> >> >>
> > >> xml-batik/resources/org/apache/batik/dom/svg/resources/
> > >> >> >> >> >>
> > >> >> >> >> >> It would probably be worth your while to break up the
> > >> >> >> >> >> 'SAXFactory.java:311' line and insert some diagnostics
> > >> to see >> >> >> >> exactly what part of the line is failing.  See
> > >> if >> something is >> >> >> wrong with the localSystemId it finds
> > >> etc...
> > >> >> >> >> >>
> > >> >> >> >> >> In this case Batik should not be accessing the web in
> > >> any >> >> way, >> it >> should pull the DTD out of the JAR file.
> > >> >> >> >> >>
> > GWJ> With this in hand, I went back to some of my reference SVG and
> > GWJ> removed the DOCTYPE and added the namespace for xlink. This
> > GWJ> workaround appears to work without issue.
> > >> >> >> >> >>
> > GWJ> Questions: 1. Is there some way to make the code use the proxy
> > GWJ> information in the browser?  - That is one of the major technical
> > GWJ> reasons behind doing this as an applet. (The other reasons are
> > GWJ> out of my control.)
> > >> >> >> >> >> The applet should already do this.
> > >> >> >> >> >>
> > GWJ> 2. Any idea why the class file version works and the JAR file
> > GWJ> version doesn't?
> > >> >> >> >> >> My guess is that when you run from source you are
> > >> getting >> the >> >> >> resources, when you build the jar you miss
> > >> them...
> > >> >> >> >> >>
> > GWJ> 3. Am I doing something incredibly wrong and there is an obvious
> > GWJ> solution I haven't noticed? <grin/> (At the rate I'm going, I'm
> > GWJ> not willing to rule this out.)
> > >> >> >> >> >> I think this is the case :)
> > >> >> >> >> >>
> > GWJ> Thanks in advance, G. Wade
> > >> >> >> >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> > >> >> >> >> >>
> > >> >> >> >> >> ---------------------------------------------------------------------
> > >> >> >> >> >> To unsubscribe, e-mail: >> >>
> > >> [EMAIL PROTECTED] >> For >> additional >> >>
> > >> commands, e-mail: [EMAIL PROTECTED]
> > >> >> >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> > >> >> >> >>
> > >> >> >> >> ---------------------------------------------------------------------
> > >> >> >> >> To unsubscribe, e-mail: >>
> > >> [EMAIL PROTECTED] >> For >> additional >>
> > >> commands, e-mail: [EMAIL PROTECTED]
> > >> >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> > >> >> >>
> > >> >> >> ---------------------------------------------------------------------
> > >> >> >> To unsubscribe, e-mail:
> > >> [EMAIL PROTECTED] >> For >> additional
> > >> commands, e-mail: [EMAIL PROTECTED]
> > >> >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> > >> >>
> > >> >> ---------------------------------------------------------------------
> > >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For >> additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED] For
> > >> additional commands, e-mail: [EMAIL PROTECTED]
> >
> > GWJ> ---------------------------------------------------------------------
> > GWJ> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > GWJ> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to