Menu

NullPointerException with jEdit and -Dswing.defaultlaf=joxy.JoxyLookAndFeel"

2012-11-05
2012-11-08
  • Lukas Jirkovsky

    Lukas Jirkovsky - 2012-11-05

    Because I don't see a way to report bugs, I'm going to report it here.

    There's a NullPointerException when joxy is applied to jEdit using the -Dswing.defaultlaf command line switch. It works fine when joxy is added to the swing.installedlafs and then selected in jEdit.

    Steps to reproduce

    $ export _JAVA_OPTIONS="-Dswing.defaultlaf=joxy.JoxyLookAndFeel"
    $ jedit

    Result

    jedit hangs on "init look and feel" and the following stacktrace is printed to console:

    Picked up _JAVA_OPTIONS: -Dswing.defaultlaf=joxy.JoxyLookAndFeel
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0: Exception in thread "AWT-EventQueue-0" 
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0: java.lang.NullPointerException
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.utils.HCYColor.<init>(HCYColor.java:25)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.utils.ColorUtils.luma(ColorUtils.java:62)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.utils.ColorUtils.shadeScheme(ColorUtils.java:82)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.utils.ColorUtils.shadeScheme(ColorUtils.java:132)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.JoxyRootPaneUI.getBackgroundRadialColor(JoxyRootPaneUI.java:205)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.JoxyRootPaneUI.paint(JoxyRootPaneUI.java:117)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at joxy.JoxyRootPaneUI.update(JoxyRootPaneUI.java:214)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.JComponent.paintComponent(JComponent.java:778)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.JComponent.paint(JComponent.java:1054)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:295)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.RepaintManager.paint(RepaintManager.java:1206)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.JComponent.paintImmediately(JComponent.java:4980)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:770)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:677)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.RepaintManager.access$700(RepaintManager.java:59)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1621)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventQueue.access$200(EventQueue.java:103)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventQueue$3.run(EventQueue.java:682)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventQueue$3.run(EventQueue.java:680)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.security.AccessController.doPrivileged(Native Method)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    7:55:34 PM [AWT-EventQueue-0] [error] AWT-EventQueue-0:  at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
    

    Additional information

     
  • Lukas Jirkovsky

    Lukas Jirkovsky - 2012-11-05

    The same happens with pdfsam 2.2.1e

     
  • Thom Castermans

    Thom Castermans - 2012-11-05

    Hello Lukas,

    Thanks

    First of all, thank you very much for your bug report. It is much appreciated that you take the time to let us know about this problem and improve Joxy with that. Special thanks for how detailed your bug report is :)

    What I did

    Now, for real. I installed jEdit (stable, 4.5.2) from the Debian repositories and was then able to reproduce your bug. However: I could not figure out what was the error! I tried to use my normal debugging routine, but apparently jEdit somehow suppresses output. Maybe I should note that as far as I can see, there should not be a NullPointerException, but of course, it occurs, so there probably is something wrong. As this error does not occur when starting other programs, I started to suspect this is really jEdit related. Thus, I commented out the line that caused the NullPointerException and changed it to something that would make it work (basically, I hardcoded a black colour somewhere). Now, jEdit started, but had the Metal LAF applied to it! Weird, I would say. So I reverted Joxy to its original state and did the following.

    Workaround

    Then, I started jEdit without the -Dswing.defaultlaf=joxy.JoxyLookAndFeel option. Now, jEdit started properly and had the Metal LAF applied to it. Then, I went to Utilities > Global Options (Ctrl + F12) > jEdit > Appearance and change the Swing LAF to Joxy in the dropdown menu. After clicking apply, Joxy was applied to jEdit and after that, I could start jEdit normally: Joxy would still be applied.

    Conclusion & further work

    So, to conclude this I would say that jEdit has some nasty code somewhere, ignoring the default or system LAF and using its own system to change the LAF. This is obviously no reason for Joxy to crash however! Therefore, I will do some more research and I will try to fix the bug. For this, I first need to find out how to log (probably have to use some jEdit logging utility), so that will take some time.

    When I find something or fix something, I will update this thread.

    Hopefully this helps you, otherwise, I'd like to hear from you.

    Cheers!
    Thom

     
  • Thom Castermans

    Thom Castermans - 2012-11-07

    Hello Lukas,

    Apparently, Willem was faster than I and fixed the bug, see commit 6c48ea. Could you check if this solves the problem for you and report back?

    Thanks a lot in advance!
    Thom

     
  • Lukas Jirkovsky

    Lukas Jirkovsky - 2012-11-08

    Thank you, it fixes both jEdit and pdfsam.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.