Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Xerces in an unsigned applet?

Status
Not open for further replies.

borbjo

Programmer
Mar 29, 2002
33
NO
I'm trying to use Xerces in an unsigned applet. I know it should be possible, but I get an AccessControlException:
Code:
        try {

            XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");


            treemodel = new XMLTreeModel( new CategoryNode(-1,"root") );

            parser.setContentHandler(treemodel);

            parser.parse(                    // <- this line will throw exception

                    new InputSource(

                            new StringReader(

                                    theXML

                            )

                    )

            );

            this.setModel(treemodel);

        } catch (SAXException e) {

            e.printStackTrace();  // Just print the stack trace

        } catch (IOException e) {

            e.printStackTrace();  // Just print the stack trace

        }


Here's the exception:

Code:
java.security.AccessControlException: access denied (java.util.PropertyPermission entityExpansionLimit read)

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)

at java.security.AccessController.checkPermission(AccessController.java:401)

at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)

at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1276)

at java.lang.System.getProperty(System.java:573)

at java.lang.Integer.getInteger(Integer.java:814)

at java.lang.Integer.getInteger(Integer.java:731)

at org.apache.xerces.impl.XMLEntityManager.reset(XMLEntityManager.java:1077)

at org.apache.xerces.parsers.BasicParserConfiguration.reset(BasicParserConfiguration.java:544)

at org.apache.xerces.parsers.DTDConfiguration.reset(DTDConfiguration.java:630)

at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:502)

at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:585)

at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)

at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1142)

at no.xait.payg.toc.CategoryTree.<init>(CategoryTree.java:55)

at no.xait.payg.toc.TocAdmin.init(TocAdmin.java:52)

at sun.applet.AppletPanel.run(AppletPanel.java:353)

at java.lang.Thread.run(Thread.java:534)

I've also tried using the parser directly (SAXParser parser = new SAXParser()). It made no difference.


Anyone know what causes this, and how to fix it? It seems to me that it has something to do with it trying to read a System property.
 
Thanks for those links. I am using Netscape yes, but it does not appear to be a Netscape problem. I just tested the applet in IE on WinXP and got the exact same response.

Also, I tried setting the property it gets an access exception when trying to retrieve (hoping that it wouldn't try to look it up then), but that didn't solve the problem either.

Code:
parser.setProperty(&quot;[URL unfurl="true"]http://apache.org/xml/properties/entity-expansion-limit&quot;,[/URL] new Integer(100000));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top