[MacOS Catalina] NPE: Couldn't execute theme name query with the Os
See original GitHub issueHi,
Just noticed this NPE, wondered if this is normal or an OS-related issue somehow.
My code calls OsThemeDetector.getDetector().isDark()
at some point, and the full stack trace reads
[AWT-EventQueue-0] ERROR com.jthemedetecor.MacOSThemeDetector - Couldn't execute theme name query with the Os
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 com.jthemedetecor.MacOSThemeDetector.isDarkTheme(MacOSThemeDetector.java:96)
at com.jthemedetecor.MacOSThemeDetector.isDark(MacOSThemeDetector.java:86)
More specifically, the NPE is due to the following call (within the isDark()
method) returning the ‘0’ byte:
Foundation.invoke(userDefaults, "objectForKey:", Foundation.nsString("AppleInterfaceStyle"))
I should mention that this happens during daytime (and luckily isDark()
returns false
), so no harm done (besides an avoidable(?) pollution of the logger)
Any clue where that might come from?
In case this helps: using version 3.7 @ openjdk11 @ macOS 10.15.7
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11
Top Results From Across the Web
Original item can't be found in Mac OS Catalina
I installed Mac OS Catalina 10.15 beta. When I go to Finder and tap on folders in the sidebar, an alert window appears...
Read more >Where is the .zshrc file on Mac? - Super User
zshrc file is not present by default in macOS Catalina, we need to create it. Steps for creation: Open Terminal; Type touch ~/.zshrc...
Read more >Word for Mac document stops responding when you try to ...
Resolution ; 1. Exit all Microsoft Office for Mac programs. ; 2. On the Go menu, click Home. ; 3. Open Library. Note...
Read more >XAMPP permissions on Mac OS X? - Stack Overflow
Tried the above but the option to amend the permission was not available for the htdocs folder,. My solution was: Open applications folder;...
Read more >macOS - Wikipedia
macOS is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
use the following two lines in log4j2.properties
reference
It sounds like you don’t want logging at all, in which case you should add sl4j-nop (no-op) logger to your dependencies. I only know log4j with that if you have a logging configuration (log4j2.xml) on your classpath it should ignore libraries that are not configured. This library uses logback with sl4j I have no knowledge of that but it shouldn’t matter if you are not using it.