question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE when adding stylesheets

See original GitHub issue

For my new ShowcaseFX view / app I constantly need to add and remove stylesheets. When doing to I keep getting this NPE:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
	at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
	at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
	at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
	at java.base/java.util.regex.Pattern.matcher(Pattern.java:1133)
	at fr.brouillard.oss.cssfx@11.5.0/fr.brouillard.oss.cssfx.impl.CSSFXMonitor$URIRegistrar.classpathToURI(CSSFXMonitor.java:319)
	at fr.brouillard.oss.cssfx@11.5.0/fr.brouillard.oss.cssfx.impl.CSSFXMonitor$URIRegistrar.register(CSSFXMonitor.java:342)
	at fr.brouillard.oss.cssfx@11.5.0/fr.brouillard.oss.cssfx.impl.CSSFXMonitor$StyleSheetChangeListener.onChanged(CSSFXMonitor.java:399)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
	at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:239)
	at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
	at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
	at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:211)
	at javafx.base/javafx.collections.ModifiableObservableListBase.addAll(ModifiableObservableListBase.java:109)
	at com.dlsc.showcasefx@0.0.6/com.dlsc.showcase.impl.CssShowcaseViewSkin.updateStylesheets(CssShowcaseViewSkin.java:103)
	at com.dlsc.showcasefx@0.0.6/com.dlsc.showcase.impl.CssShowcaseViewSkin.lambda$new$0(CssShowcaseViewSkin.java:90)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemmermanncommented, Jan 26, 2022

Never mind … I found out what the issue was. My code was adding multiple configurations to the view when dropping multiple files. One config per file. This then caused each config to be selected, which removed the stylesheets from the previous config, and so on … obviously messy.

0reactions
dlemmermanncommented, Jan 26, 2022

I only get the error when I do a drag and drop of MULTIPLE css files at the same time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getstylesheets is giving a nullpointerexception in Javafx, how ...
1 Answer 1 ... The problem lies in getClass() which resolves resources relative to the path of the class. So getClass().getResource("MainMenu.css") ...
Read more >
Bug #3797: NPE in stylesheet compilation (no retained static ...
NPE occurred during stylesheet compilation. Command-line result. How to reproduce the problem: Unzip attached dita-ot-3.0.3-bil.zip to any ...
Read more >
java.lang.NullPointerException - Not picking up CSS file
I have installed the pd4ml_demo.jar and it renders my HTML page correctly. However, the CSS file referenced as a link in the HEAD...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
1. Let's consider the below function and look out for scenario causing null pointer exception. · 2. We can also add null check...
Read more >
[JDK-8095860] BSS (Binary CSS) throws an NPE immediately ...
Relatively self-explanatory, when trying to add a .css file that is converted to binary (and thus a .bss file), javafx throws a NPE....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found