kirill-grouchnikov / substance

A modern and high-performant Swing look-and-feel library
163 stars 110 forks source link

NPE on StandardBorderPainter.paintBorder #56

Closed bflorat closed 6 years ago

bflorat commented 6 years ago

Version of Substance

8.0.0dev , caebd791f0089eb02f554b09645e745ee5b92b9f

Version of Java

1.9

Version of OS

Fedora 26

The issue you're experiencing (expected vs actual, screenshot, stack trace etc)

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at org.pushingpixels.substance.api.painter.border.StandardBorderPainter.paintBorder(StandardBorderPainter.java:98) at org.pushingpixels.substance.internal.utils.SubstanceImageCreator.getTreeIcon(SubstanceImageCreator.java:1400) at org.pushingpixels.substance.internal.utils.icon.SubstanceIconFactory$TreeIcon.getIcon(SubstanceIconFactory.java:790) at org.pushingpixels.substance.internal.utils.icon.SubstanceIconFactory$TreeIcon.paintIcon(SubstanceIconFactory.java:813) at org.pushingpixels.substance.api.hidpi.HiDpiAwareIcon.paintIcon(HiDpiAwareIcon.java:101) at java.desktop/javax.swing.plaf.basic.BasicButtonUI.paintIcon(BasicButtonUI.java:358) at org.jdesktop.swingx.plaf.basic.BasicHyperlinkUI.paint(BasicHyperlinkUI.java:187) at java.desktop/javax.swing.plaf.ComponentUI.update(ComponentUI.java:161) at java.desktop/javax.swing.JComponent.paintComponent(JComponent.java:798) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1075) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JViewport.paint(JViewport.java:737) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at org.jdesktop.swingx.JXPanel.paint(JXPanel.java:383) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JSplitPane.paintChildren(JSplitPane.java:1024) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at com.vlsolutions.swing.docking.SplitContainer.paint(SplitContainer.java:255) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at org.jdesktop.swingx.JXPanel.paint(JXPanel.java:383) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590) at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908) at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084) at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5256) at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:246) at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1313) at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5204) at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5014) at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:857) at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:840) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89) at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:840) at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:815) at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:764) at java.desktop/javax.swing.RepaintManager.access$1200(RepaintManager.java:69) at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1880) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764) at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717) at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90

kirill-grouchnikov commented 6 years ago

Looks like you're not using the Substance plugin for SwingX components. Starting in version 8.0, you need to explicitly register Substance plugins. For now this is done with SubstancePluginRepository.getInstance().registerComponentPlugin(new SubstanceSwingxPlugin()).

The location and the signature of the API will undergo revisions in the context of https://github.com/kirill-grouchnikov/substance/issues/45 in the next couple of months.

kirill-grouchnikov commented 6 years ago

Looking at the stack trace, this is actually a regression introduced recently in that painter.

bflorat commented 6 years ago

Thanks.

boolean isSpecialButton = (c == null)? false : 
                c.getClass().isAnnotationPresent(SubstanceInternalArrowButton.class);

works for me . I assume you don't need a PR ?

kirill-grouchnikov commented 6 years ago

The regression was introduced as part of https://github.com/kirill-grouchnikov/substance/commit/cce730ecca01184b15fae070b48771f2b5f74085

kirill-grouchnikov commented 6 years ago

No need for a pull request. It will be something like

        boolean isSpecialButton = (c != null)
                && c.getClass().isAnnotationPresent(SubstanceInternalArrowButton.class);

a bit later in the day

bflorat commented 6 years ago

Fine, thx