kirill-grouchnikov / substance

A modern and high-performant Swing look-and-feel library
164 stars 109 forks source link

NullPointerException for Business L&F under Java 9 #75

Closed ajaymills closed 6 years ago

ajaymills commented 6 years ago

Version of Substance

7.1.01

Version of Java

9.0.4

Version of OS

Windows 10

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

Hi, I've been working to upgrade my Java application to Java 9. I know it's not officially supported, so I modularized the jar file on my own by introducing a module-info.java file. It pretty much fully works except our old L&F, SubstanceBusinessBlackSteelLookAndFeel throws the below exception at runtime.

A non-business L&F such as SubstanceModerateLookAndFeel works fine.

Any idea what might have broken in SubstanceBusinessBlackSteelLookAndFeel ? In my module-info.java I export and open every package (e.g. just to be super paranoid).


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.api.painter.decoration.ImageWrapperDecorationPainter.getColorizedTile(ImageWrapperDecorationPainter.java:267)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.api.painter.decoration.ImageWrapperDecorationPainter.tileArea(ImageWrapperDecorationPainter.java:214)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.api.painter.decoration.ImageWrapperDecorationPainter.paintExtraBackground(ImageWrapperDecorationPainter.java:178)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.api.painter.decoration.ImageWrapperDecorationPainter.paintDecorationArea(ImageWrapperDecorationPainter.java:102)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.internal.painter.DecorationPainterUtils.paintDecorationBackground(DecorationPainterUtils.java:223)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.internal.painter.DecorationPainterUtils.paintDecorationBackground(DecorationPainterUtils.java:182)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.internal.painter.BackgroundPaintingUtils.update(BackgroundPaintingUtils.java:106)
    at substance.org.pushingpixels.substance/org.pushingpixels.substance.internal.ui.SubstanceMenuBarUI.update(SubstanceMenuBarUI.java:145)
    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.JLayeredPane.paint(JLayeredPane.java:590)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908)
    at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5263)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1633)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1608)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1546)
    at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1313)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1061)
    at java.desktop/java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
    at java.desktop/sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78)
    at java.desktop/sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115)
    at java.desktop/java.awt.Container.paint(Container.java:1998)
    at java.desktop/java.awt.Window.paint(Window.java:3926)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:868)
    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

There have been quite a few changes between 7.1 and the upcoming 8.0 releases. The stack trace lines at the very top in ImageWrapperDecorationPainter no longer match.

Just tried the main Substance demo app under Black Steel skin on Java 9 (which is fully supported even without modularizing Substance) and Windows 10, and I don't see any crashes.

If this is still happening for you under the latest development bits of Substance 8.0 (see migration guide at https://github.com/kirill-grouchnikov/substance/blob/master/www/release-info/8.0/release-info.md ) then I'll need to see a small, standalone and complete sample that reproduces this issue.

kirill-grouchnikov commented 6 years ago

Also, until Substance and other projects move to Java 9 as the minimum runtime, there will be no modularization of these projects, so if this only happens under the locally modularized version of Substance, it's not going to be a priority on my side.

ajaymills commented 6 years ago

So, just your affirmation that it should be working lead me to trying the v8 dev version, which does line up better with the source code. In that way I was able to trace the problem to one that I had caused myself: the resource folder was not available which caused a variable to be nullified at init time. I'm sure 7 was working fine too. Thanks

kirill-grouchnikov commented 6 years ago

Thanks for the confirmation. I'll move the brushed.gif from resource/ folder to another one that aligns better with the package structure of Substance.