#190 Mode parser throws exceptions

minor bug
closed-fixed
nobody
5
2001-01-22
2000-10-30
Kristian Ovaska
No

Mode parser throws exceptions when there are XML elements with no content. Such mode files are obviously invalid, but I still think it would be better to catch those errors.

I'm running 2.6pre9 and JDK 1.3.

In quick testing, I found out that elements SEQ, EOL_SPAN and SPAN throw ArrayIndexOutOfBoundsExceptions. I would expect the rest to cause similar behaviour. However, empty keywords don't seem to throw any exceptions.

Example:
<SEQ TYPE="OPERATOR"></SEQ>

Stack trace:
[error] jEdit: java.lang.ArrayIndexOutOfBoundsException
[error] jEdit: at org.gjt.sp.jedit.syntax.ParserRuleSet.addRule(ParserRuleSet.java:41)
[error] jEdit: at org.gjt.sp.jedit.XModeHandler.addRule(XModeHandler.java:521)
[error] jEdit: at org.gjt.sp.jedit.XModeHandler.endElement(XModeHandler.java:314)
[error] jEdit: at com.microstar.xml.XmlParser.parseETag(XmlParser.java:1041)
[error] jEdit: at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1112)
[error] jEdit: at com.microstar.xml.XmlParser.parseElement(XmlParser.java:947)
[error] jEdit: at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1118)
[error] jEdit: at com.microstar.xml.XmlParser.parseElement(XmlParser.java:947)
[error] jEdit: at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1118)
[error] jEdit: at com.microstar.xml.XmlParser.parseElement(XmlParser.java:947)
[error] jEdit: at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1118)
[error] jEdit: at com.microstar.xml.XmlParser.parseElement(XmlParser.java:947)
[error] jEdit: at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:496)
[error] jEdit: at com.microstar.xml.XmlParser.doParse(XmlParser.java:176)
[error] jEdit: at com.microstar.xml.XmlParser.parse(XmlParser.java:146)
[error] jEdit: at org.gjt.sp.jedit.jEdit.loadMode(jEdit.java:945)
[error] jEdit: at org.gjt.sp.jedit.jEdit.loadModes(jEdit.java:927)
[error] jEdit: at org.gjt.sp.jedit.jEdit.createModeCache(jEdit.java:843)
[error] jEdit: at org.gjt.sp.jedit.actions.reload_modes.actionPerformed(reload_modes.java:41)
[error] jEdit: at org.gjt.sp.jedit.gui.InputHandler.executeAction(InputHandler.java:225)
[error] jEdit: at org.gjt.sp.jedit.EditAction$Wrapper.actionPerformed(EditAction.java:296)
[error] jEdit: at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
[error] jEdit: at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
[error] jEdit: at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
[error] jEdit: at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
[error] jEdit: at javax.swing.AbstractButton.doClick(Unknown Source)
[error] jEdit: at javax.swing.plaf.basic.BasicMenuUI$ReturnAction.actionPerformed(Unknown Source)
[error] jEdit: at javax.swing.SwingUtilities.notifyAction(Unknown Source)
[error] jEdit: at javax.swing.JComponent.processKeyBinding(Unknown Source)
[error] jEdit: at javax.swing.KeyboardManager.fireBinding(Unknown Source)
[error] jEdit: at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
[error] jEdit: at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
[error] jEdit: at javax.swing.JComponent.processKeyBindings(Unknown Source)
[error] jEdit: at javax.swing.JComponent.processKeyEvent(Unknown Source)
[error] jEdit: at javax.swing.JMenu.processKeyEvent(Unknown Source)
[error] jEdit: at java.awt.Component.processEvent(Unknown Source)
[error] jEdit: at java.awt.Container.processEvent(Unknown Source)
[error] jEdit: at java.awt.Component.dispatchEventImpl(Unknown Source)
[error] jEdit: at java.awt.Container.dispatchEventImpl(Unknown Source)
[error] jEdit: at java.awt.Component.dispatchEvent(Unknown Source)
[error] jEdit: at java.awt.LightweightDispatcher.processKeyEvent(Unknown Source)
[error] jEdit: at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
[error] jEdit: at java.awt.Container.dispatchEventImpl(Unknown Source)
[error] jEdit: at java.awt.Window.dispatchEventImpl(Unknown Source)
[error] jEdit: at java.awt.Component.dispatchEvent(Unknown Source)
[error] jEdit: at java.awt.EventQueue.dispatchEvent(Unknown Source)
[error] jEdit: at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
[error] jEdit: at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
[error] jEdit: at java.awt.EventDispatchThread.run(Unknown Source)

Discussion

  • Slava Pestov
    Slava Pestov
    2001-01-22

    • status: open --> closed-fixed