Debugger Preferences disappear when invalid values are set
When setting the preferences of debugger properties (such as the number of leading diagnoses) to a value that is out of the expected range of the SpinnerModel an exception is thrown (see below) that causes the removal of the Debugger Preferences:
12:52:33.921 [AWT-EventQueue-0] WARN o.p.e.c.u.p.PreferencesDialogPanel - An error occurred whilst trying to instantiate the preferences panel plugin 'Debugger': {}
java.lang.IllegalArgumentException: (minimum <= value <= maximum) is false
at javax.swing.SpinnerNumberModel.<init>(SpinnerNumberModel.java:125) ~[na:1.8.0_91]
at javax.swing.SpinnerNumberModel.<init>(SpinnerNumberModel.java:164) ~[na:1.8.0_91]
at org.exquisite.protege.ui.panel.QueryOptPanel.createPanel(QueryOptPanel.java:96) ~[na:na]
at org.exquisite.protege.ui.panel.QueryOptPanel.<init>(QueryOptPanel.java:42) ~[na:na]
at org.exquisite.protege.ui.panel.QueryDebuggerPreferencesPanel.initialise(QueryDebuggerPreferencesPanel.java:25) ~[na:na]
at org.protege.editor.core.ui.preferences.PreferencesDialogPanel.<init>(PreferencesDialogPanel.java:61) [protege-editor-core.jar:na]
at org.protege.editor.core.ui.preferences.PreferencesDialogPanel.showPreferencesDialog(PreferencesDialogPanel.java:119) [protege-editor-core.jar:na]
at org.protege.editor.core.ui.workspace.Workspace.lambda$installFileMenu$1(Workspace.java:163) [protege-editor-core.jar:na]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) ~[na:1.8.0_91]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) ~[na:1.8.0_91]
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) ~[na:1.8.0_91]
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) ~[na:1.8.0_91]
at javax.swing.AbstractButton.doClick(AbstractButton.java:376) ~[na:1.8.0_91]
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) ~[na:1.8.0_91]
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) ~[na:1.8.0_91]
at java.awt.Component.processMouseEvent(Component.java:6535) ~[na:1.8.0_91]
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) ~[na:1.8.0_91]
at java.awt.Component.processEvent(Component.java:6300) ~[na:1.8.0_91]
at java.awt.Container.processEvent(Container.java:2236) ~[na:1.8.0_91]
at java.awt.Component.dispatchEventImpl(Component.java:4891) ~[na:1.8.0_91]
at java.awt.Container.dispatchEventImpl(Container.java:2294) ~[na:1.8.0_91]
at java.awt.Component.dispatchEvent(Component.java:4713) ~[na:1.8.0_91]
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) ~[na:1.8.0_91]
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) ~[na:1.8.0_91]
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) ~[na:1.8.0_91]
at java.awt.Container.dispatchEventImpl(Container.java:2280) ~[na:1.8.0_91]
at java.awt.Window.dispatchEventImpl(Window.java:2750) ~[na:1.8.0_91]
at java.awt.Component.dispatchEvent(Component.java:4713) ~[na:1.8.0_91]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) ~[na:1.8.0_91]
at java.awt.EventQueue.access$500(EventQueue.java:97) ~[na:1.8.0_91]
at java.awt.EventQueue$3.run(EventQueue.java:709) ~[na:1.8.0_91]
at java.awt.EventQueue$3.run(EventQueue.java:703) ~[na:1.8.0_91]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_91]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) ~[na:1.8.0_91]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) ~[na:1.8.0_91]
at java.awt.EventQueue$4.run(EventQueue.java:731) ~[na:1.8.0_91]
at java.awt.EventQueue$4.run(EventQueue.java:729) ~[na:1.8.0_91]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_91]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) ~[na:1.8.0_91]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) ~[na:1.8.0_91]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) ~[na:1.8.0_91]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) ~[na:1.8.0_91]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) ~[na:1.8.0_91]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) ~[na:1.8.0_91]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) ~[na:1.8.0_91]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) ~[na:1.8.0_91]
The debugger preference values can be either set
- in the preferences panel or
- in the user's home directory unter
.protege\org.exquisite.protege\exquisitedebugger.properties
therefore both cases have to be taken into consideration in the fix.
Solution: implement an input validation mechanism!