Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Pointer Exception on Start #55

Open
dpolivaev opened this issue Aug 4, 2019 · 2 comments
Open

Null Pointer Exception on Start #55

dpolivaev opened this issue Aug 4, 2019 · 2 comments

Comments

@dpolivaev
Copy link

SwingSet2 demo with -Dswing.defaultlaf=com.bulenkov.darcula.DarculaLaf on Linux with Java 8 u 222 exits with exception

/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/bin/java -Dswing.defaultlaf=com.bulenkov.darcula.DarculaLaf -javaagent:/home/dimitry/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/191.7479.19/lib/idea_rt.jar=40943:/home/dimitry/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/191.7479.19/bin -Dfile.encoding=UTF-8 -classpath /home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/charsets.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/cldrdata.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/dnsns.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/jaccess.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/localedata.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/nashorn.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/openjsse.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/sunec.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/sunjce_provider.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/sunpkcs11.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/ext/zipfs.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/jce.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/jfr.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/jsse.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/management-agent.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/resources.jar:/home/dimitry/.sdkman/candidates/java/8.0.222-zulu/jre/lib/rt.jar:/home/dimitry/temp/Darcula/out/production/demo:/home/dimitry/temp/Darcula/lib/iconloader.jar:/home/dimitry/temp/Darcula/lib/demo/AnimatedTransitions.jar:/home/dimitry/temp/Darcula/lib/demo/AppFramework.jar:/home/dimitry/temp/Darcula/lib/demo/swing-worker.jar:/home/dimitry/temp/Darcula/lib/demo/swingx.jar:/home/dimitry/temp/Darcula/lib/demo/TimingFramework.jar:/home/dimitry/temp/Darcula/out/production/Darcula:/home/dimitry/temp/Darcula/lib/annotations.jar SwingSet2
Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.bulenkov.iconloader.IconLoader.<clinit>(IconLoader.java:53)
	at com.bulenkov.darcula.DarculaLaf.getDefaults(DarculaLaf.java:97)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:539)
	at javax.swing.UIManager.setLookAndFeel(UIManager.java:583)
	at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1349)
	at javax.swing.UIManager.initialize(UIManager.java:1459)
	at javax.swing.UIManager.maybeInitialize(UIManager.java:1426)
	at javax.swing.UIManager.getUI(UIManager.java:1006)
	at javax.swing.JPanel.updateUI(JPanel.java:126)
	at javax.swing.JPanel.<init>(JPanel.java:86)
	at javax.swing.JPanel.<init>(JPanel.java:109)
	at javax.swing.JPanel.<init>(JPanel.java:117)
	at SwingSet2.<init>(SwingSet2.java:182)
	at SwingSet2.main(SwingSet2.java:245)
Caused by: java.lang.NullPointerException
	at com.bulenkov.iconloader.util.UIUtil.initSystemFontData(UIUtil.java:254)
	at com.bulenkov.iconloader.util.JBUI.calculateScaleFactor(JBUI.java:47)
	at com.bulenkov.iconloader.util.JBUI.<clinit>(JBUI.java:33)
	... 14 more

Process finished with exit code 1

It turns out that com.bulenkov.iconloader.util.UIUtil.getLabelFont() returns null and this is not expected.

Could you please give any advice on how to handle this problem?

@muehmar
Copy link

muehmar commented Sep 14, 2019

In my case, I set the look and feel programmatically in my project and had the same issue. I didn't figure out whats actually the problem, but the following workaround works for me: First I set one of the installed look and feel and then set the darcula look and feel.

@dpolivaev
Copy link
Author

Fixed in #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants