#23 java.lang.ArithmeticException: / by zero Exception

v1.3.x
closed-invalid
nobody
None
5
2014-03-26
2012-12-10
Zeljko Obrenovic
No

I am receiving the following exception every time the user clicks on the text area (i.e. when editing starts:

Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero
at org.fife.ui.rsyntaxtextarea.SyntaxView.viewToModel(SyntaxView.java:801)
at javax.swing.plaf.basic.BasicTextUI$RootView.viewToModel(BasicTextUI.java:1540)
at javax.swing.plaf.basic.BasicTextUI.viewToModel(BasicTextUI.java:1089)
at javax.swing.text.DefaultCaret.positionCaret(DefaultCaret.java:290)
at javax.swing.text.DefaultCaret.adjustCaret(DefaultCaret.java:495)
at javax.swing.text.DefaultCaret.adjustCaretAndFocus(DefaultCaret.java:483)
at javax.swing.text.DefaultCaret.mousePressed(DefaultCaret.java:473)
at org.fife.ui.rtextarea.ConfigurableCaret.mousePressed(ConfigurableCaret.java:371)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:263)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:262)
at java.awt.Component.processMouseEvent(Component.java:6287)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6055)
at java.awt.Container.processEvent(Container.java:2039)
at java.awt.Component.dispatchEventImpl(Component.java:4653)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at javax.swing.plaf.basic.BasicTableUI$Handler.repostEvent(BasicTableUI.java:918)
at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleasedDND(BasicTableUI.java:1162)
at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1126)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
at java.awt.Component.processMouseEvent(Component.java:6290)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6055)
at java.awt.Container.processEvent(Container.java:2039)
at java.awt.Component.dispatchEventImpl(Component.java:4653)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
at java.awt.Container.dispatchEventImpl(Container.java:2083)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
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$2.run(EventQueue.java:621)
at java.awt.EventQueue$2.run(EventQueue.java:619)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Discussion

  • Robert Futrell
    Robert Futrell
    2013-01-23

    Is this still reproducible? Did you instantiate your entire GUI on the EDT?

    I can't reproduce this locally, and haven't had any other reports of it. The only way I believe this can happen is if your SyntaxScheme has all null values for fonts, and the text component's font (e.g. textArea.getFont()) has a 0 height (which I'm pretty sure is not possible).

    If anyone gets this exception, if you could give more information that would be great. Even better - set a breakpoint in the RSyntaxTextArea.calculateLineHeight() method and see why lineHeight isn't getting set to some value > 0.

     
  • Robert Futrell
    Robert Futrell
    2014-03-26

    Closing since I cannot reproduce this, and nobody else has reported it.

     
  • Robert Futrell
    Robert Futrell
    2014-03-26

    • status: open --> closed-invalid
    • Group: --> v1.3.x