compbio-UofT / medsavant

MedSavant is a search engine for genetic variants
22 stars 9 forks source link

JIDE Exception related to RangeSliders #26

Closed jvlasblom closed 11 years ago

jvlasblom commented 11 years ago

Editing a pillview with a range slider generates a nullpointer exception by JIDE (e.g. if you add a position to the search conditions and then try to edit it). Confirmed on Linux, Java 1.7.0_25. Does not occur on OS X. Not yet tested on Windows.

Exception:

java.lang.NullPointerException at javax.swing.plaf.metal.MetalSliderUI.installUI(MetalSliderUI.java:110) at javax.swing.JComponent.setUI(JComponent.java:664) at com.jidesoft.swing.RangeSlider.updateUI(RangeSlider.java:90) at javax.swing.JSlider.(JSlider.java:275) at javax.swing.JSlider.(JSlider.java:182) at com.jidesoft.swing.RangeSlider.(RangeSlider.java:35) at org.ut.biolab.medsavant.client.view.component.DecimalRangeSlider.(DecimalRangeSlider.java:30) at org.ut.biolab.medsavant.client.view.component.DecimalRangeSlider.(DecimalRangeSlider.java:43) at org.ut.biolab.mfiume.query.view.NumberSearchConditionEditorView.loadViewFromSearchConditionParameters(NumberSearchConditionEditorView.java:61) at org.ut.biolab.mfiume.query.view.SearchConditionEditorView.loadViewFromExistingSearchConditionParameters(SearchConditionEditorView.java:27) at org.ut.biolab.mfiume.query.view.SearchConditionItemView$2$2$1.run(SearchConditionItemView.java:102) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) java.awt.IllegalComponentStateException: com.jidesoft.plaf.metal.MetalRangeSliderUI@44e44791 was asked to deinstall() org.ut.biolab.medsavant.client.view.component.DecimalRangeSlider[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,isInverted=false,majorTickSpacing=5,minorTickSpacing=1,orientation=HORIZONTAL,paintLabels=false,paintTicks=false,paintTrack=true,snapToTicks=false,snapToValue=true] when it only knows about null. at javax.swing.plaf.basic.BasicSliderUI.uninstallUI(BasicSliderUI.java:167) at javax.swing.JComponent.uninstallUIAndProperties(JComponent.java:679) at javax.swing.JComponent.setUI(JComponent.java:656) at com.jidesoft.swing.RangeSlider.updateUI(RangeSlider.java:90) at org.ut.biolab.mfiume.query.view.NumberSearchConditionEditorView.setExtremeValues(NumberSearchConditionEditorView.java:199) at org.ut.biolab.mfiume.query.view.NumberSearchConditionEditorView.loadViewFromSearchConditionParameters(NumberSearchConditionEditorView.java:157) at org.ut.biolab.mfiume.query.view.SearchConditionEditorView.loadViewFromExistingSearchConditionParameters(SearchConditionEditorView.java:27) at org.ut.biolab.mfiume.query.view.SearchConditionItemView$2$2$1.run(SearchConditionItemView.java:102) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) java.awt.IllegalComponentStateException: com.jidesoft.plaf.metal.MetalRangeSliderUI@44e44791 was asked to deinstall() org.ut.biolab.medsavant.client.view.component.DecimalRangeSlider[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,isInverted=false,majorTickSpacing=5,minorTickSpacing=1,orientation=HORIZONTAL,paintLabels=false,paintTicks=false,paintTrack=true,snapToTicks=false,snapToValue=true] when it only knows about null. at javax.swing.plaf.basic.BasicSliderUI.uninstallUI(BasicSliderUI.java:167) at javax.swing.JComponent.uninstallUIAndProperties(JComponent.java:679) at javax.swing.JComponent.setUI(JComponent.java:656) at com.jidesoft.swing.RangeSlider.updateUI(RangeSlider.java:90) at org.ut.biolab.mfiume.query.view.NumberSearchConditionEditorView.setSelectedValues(NumberSearchConditionEditorView.java:216) at org.ut.biolab.mfiume.query.view.NumberSearchConditionEditorView.loadViewFromSearchConditionParameters(NumberSearchConditionEditorView.java:161) at org.ut.biolab.mfiume.query.view.SearchConditionEditorView.loadViewFromExistingSearchConditionParameters(SearchConditionEditorView.java:27) at org.ut.biolab.mfiume.query.view.SearchConditionItemView$2$2$1.run(SearchConditionItemView.java:102) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) Jul 02, 2013 4:51:35 PM org.ut.biolab.mfiume.query.view.SearchConditionItemView$2$2 run SEVERE: null java.lang.reflect.InvocationTargetException at java.awt.EventQueue.invokeAndWait(EventQueue.java:1272) at java.awt.EventQueue.invokeAndWait(EventQueue.java:1247) at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1349) at org.ut.biolab.mfiume.query.view.SearchConditionItemView$2$2.run(SearchConditionItemView.java:98) Caused by: java.lang.NullPointerException at javax.swing.plaf.basic.BasicSliderUI.recalculateIfInsetsChanged(BasicSliderUI.java:946) at javax.swing.plaf.basic.BasicSliderUI.getMinimumSize(BasicSliderUI.java:488) at javax.swing.JComponent.getMinimumSize(JComponent.java:1742) at javax.swing.BoxLayout.checkRequests(BoxLayout.java:482) at javax.swing.BoxLayout.minimumLayoutSize(BoxLayout.java:325) at java.awt.Container.minimumSize(Container.java:1840) at java.awt.Container.getMinimumSize(Container.java:1825) at javax.swing.JComponent.getMinimumSize(JComponent.java:1744) at javax.swing.BoxLayout.checkRequests(BoxLayout.java:482) at javax.swing.BoxLayout.minimumLayoutSize(BoxLayout.java:325) at java.awt.Container.minimumSize(Container.java:1840) at java.awt.Container.getMinimumSize(Container.java:1825) at javax.swing.JComponent.getMinimumSize(JComponent.java:1744) at java.awt.FlowLayout.minimumLayoutSize(FlowLayout.java:463) at java.awt.Container.minimumSize(Container.java:1840) at java.awt.Container.getMinimumSize(Container.java:1825) at javax.swing.JComponent.getMinimumSize(JComponent.java:1744) at javax.swing.BoxLayout.checkRequests(BoxLayout.java:482) at javax.swing.BoxLayout.minimumLayoutSize(BoxLayout.java:325) at java.awt.Container.minimumSize(Container.java:1840) at java.awt.Container.getMinimumSize(Container.java:1825) at javax.swing.JComponent.getMinimumSize(JComponent.java:1744) at javax.swing.BoxLayout.checkRequests(BoxLayout.java:482) at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:300) at javax.swing.plaf.basic.DefaultMenuLayout.preferredLayoutSize(DefaultMenuLayout.java:60) at javax.swing.plaf.synth.SynthMenuLayout.preferredLayoutSize(SynthMenuLayout.java:51) at java.awt.Container.preferredSize(Container.java:1788) at java.awt.Container.getPreferredSize(Container.java:1773) at javax.swing.JComponent.getPreferredSize(JComponent.java:1662) at javax.swing.JPopupMenu.pack(JPopupMenu.java:734) at org.ut.biolab.mfiume.query.view.SearchConditionItemView$2$2$1.run(SearchConditionItemView.java:112) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

2013-07-02 16:51:35,078 27598 [AWT-EventQueue-0] INFO org.ut.biolab.medsavant.MedSavantClient - Global exception handler caught: AWT-EventQueue-0: java.lang.NullPointerException java.lang.NullPointerException at javax.swing.SizeRequirements.calculateAlignedPositions(SizeRequirements.java:461) at javax.swing.BoxLayout.layoutContainer(BoxLayout.java:434) at java.awt.Container.layout(Container.java:1503) at java.awt.Container.doLayout(Container.java:1492) at java.awt.Container.validateTree(Container.java:1688) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validateTree(Container.java:1697) at java.awt.Container.validate(Container.java:1623) at javax.swing.RepaintManager$2.run(RepaintManager.java:679) at javax.swing.RepaintManager$2.run(RepaintManager.java:677) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:676) at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1646) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:703) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

sdumitriu commented 11 years ago

Does this only happen with the upgraded 3.5.6 version?

jvlasblom commented 11 years ago

No, it also happened with the version immediately before your most recently committed changes to the JIDE version.

On 07/03/2013 12:43 PM, Sergiu Dumitriu wrote:

Does this only happen with the upgraded 3.5.6 version?

— Reply to this email directly or view it on GitHub https://github.com/compbio-UofT/medsavant/issues/26#issuecomment-20428774.

jvlasblom commented 11 years ago

The exception happens because of keys that are unset with certain look-and-feels.
These keys (e.g. Slider.trackWidth) aren't being set on Linux/Java 1.7 with the GTK theme:

Missing key Slider.trackWidth Missing key Slider.majorTickLength Missing key Slider.horizontalThumbIcon Missing key Slider.verticalThumbIcon Missing key Slider.thumb Missing key Slider.darkShadow

I used defaults from the metal look and feel to initialize these only if they aren't other already set by the system default look and feel:

defaultValues.put("Slider.trackWidth", new Integer(7));

defaultValues.put("Slider.majorTickLength", new Integer(6));

defaultValues.put("Slider.highlight", new ColorUIResource(255, 255, 255));

defaultValues.put("Slider.horizontalThumbIcon", javax.swing.plaf.metal.MetalIconFactory.getHorizontalSliderThumbIcon());

defaultValues.put("Slider.verticalThumbIcon", javax.swing.plaf.metal.MetalIconFactory.getVerticalSliderThumbIcon());

defaultValues.put("Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0));

Sliders are a bit ugly, but the rest of the look-and-feel is unchanged. The look could be improved with custom slider icons.

shot

sdumitriu commented 11 years ago

There's an additional jide-plaf library that might fix the issue. Did you try using it?

jvlasblom commented 11 years ago

I just tried it now, but I still received the error. The API documentation also implied that keys are missing from GTK. The error they're talking about is different than the one I encountered, but it suggests that some manual setting of UIDefaults is necessary :

(From http://www.jidesoft.com/javadoc/com/jidesoft/plaf/LookAndFeelFactory.html) You will end up with NPE later in the code when you call installJideExtension. In this case, you can add those extra UIDefaults in UIDefaultsInitializer. We will call it before installJideExtension is called so that those UIDefaults are there ready for us to use. This is how added support to GTK L&F and Synthetica L&F.

On 07/03/2013 02:54 PM, Sergiu Dumitriu wrote:

There's an additional |jide-plaf| library that might fix the issue. Did you try using it?

— Reply to this email directly or view it on GitHub https://github.com/compbio-UofT/medsavant/issues/26#issuecomment-20437385.

sdumitriu commented 11 years ago

OK, so basically they designed a library that might fail unless API users take extra care to initialize some defaults... Not very nice...

Anyway, don't forget to push the commits.