Problem with Loading Theme

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Problem with Loading Theme

Postby Azlan » Sun May 12, 2013 7:54 pm

I've been trying to load a theme, and I've had a problem with it. I put the "theme.dtd" in the root of the project, the themes folder in the project, and the src folder in the project. Each time nothing worked. Here's the code I'm using:

java code:

InputStream in = getClass().getResourceAsStream("themes/eclipse.xml");
try {
Theme theme = Theme.load(in);
theme.apply(textArea);
} catch (IOException ioe) {
ioe.printStackTrace();
}


I'm working in Eclipse if it helps. Also, it seems I'm getting a decent sized stacktrace when I run it. It says it's a Java io exception, but I know all the themes are in the right places.

Here's a dump of the stacktrace:

Code: Select all
java.io.IOException: Stream closed
   at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:134)
   at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
   at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2978)
   at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:738)
   at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
   at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
   at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
   at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
   at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
   at org.fife.ui.rsyntaxtextarea.Theme$XmlHandler.load(Theme.java:593)
   at org.fife.ui.rsyntaxtextarea.Theme.load(Theme.java:337)
   at org.fife.ui.rsyntaxtextarea.Theme.load(Theme.java:315)
   at jwebcontrol.Test$10.actionPerformed(Test.java:379)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
   at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
   at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
   at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
   at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
   at java.awt.Component.processMouseEvent(Component.java:6382)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
   at java.awt.Component.processEvent(Component.java:6147)
   at java.awt.Container.processEvent(Container.java:2083)
   at java.awt.Component.dispatchEventImpl(Component.java:4744)
   at java.awt.Container.dispatchEventImpl(Container.java:2141)
   at java.awt.Component.dispatchEvent(Component.java:4572)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4280)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
   at java.awt.Container.dispatchEventImpl(Container.java:2127)
   at java.awt.Window.dispatchEventImpl(Window.java:2489)
   at java.awt.Component.dispatchEvent(Component.java:4572)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:710)
   at java.awt.EventQueue.access$400(EventQueue.java:82)
   at java.awt.EventQueue$2.run(EventQueue.java:669)
   at java.awt.EventQueue$2.run(EventQueue.java:667)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
   at java.awt.EventQueue$3.run(EventQueue.java:683)
   at java.awt.EventQueue$3.run(EventQueue.java:681)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:680)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
java.io.IOException: java.io.IOException: Stream closed
   at org.fife.ui.rsyntaxtextarea.Theme$XmlHandler.load(Theme.java:596)
   at org.fife.ui.rsyntaxtextarea.Theme.load(Theme.java:337)
   at org.fife.ui.rsyntaxtextarea.Theme.load(Theme.java:315)
   at jwebcontrol.Test$10.actionPerformed(Test.java:379)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
   at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
   at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
   at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
   at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
   at java.awt.Component.processMouseEvent(Component.java:6382)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
   at java.awt.Component.processEvent(Component.java:6147)
   at java.awt.Container.processEvent(Container.java:2083)
   at java.awt.Component.dispatchEventImpl(Component.java:4744)
   at java.awt.Container.dispatchEventImpl(Container.java:2141)
   at java.awt.Component.dispatchEvent(Component.java:4572)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4280)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
   at java.awt.Container.dispatchEventImpl(Container.java:2127)
   at java.awt.Window.dispatchEventImpl(Window.java:2489)
   at java.awt.Component.dispatchEvent(Component.java:4572)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:710)
   at java.awt.EventQueue.access$400(EventQueue.java:82)
   at java.awt.EventQueue$2.run(EventQueue.java:669)
   at java.awt.EventQueue$2.run(EventQueue.java:667)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
   at java.awt.EventQueue$3.run(EventQueue.java:683)
   at java.awt.EventQueue$3.run(EventQueue.java:681)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:680)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


After reading through it, I realized that the code I gave you is the only code that's giving this a stacktrace in my project.
Azlan
 
Posts: 14
Joined: Thu Apr 11, 2013 4:54 pm

Re: Problem with Loading Theme

Postby robert » Mon May 13, 2013 2:48 am

It's quite likely that "in" is null. Make sure the theme XML file(s) are where you think they are.
User avatar
robert
 
Posts: 794
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron