Page 1 of 1

[Solved] Why: java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lang" is null

Posted: Mon Jun 17, 2024 12:55 pm
by wiegleyj
I trying to run UMS 14.0.2 and trying to get sorting working. It doesn't. The renders just seem to display everything in random order.

The biggest indicator I'm seeing of a problem is TONS of this:

Code: Select all

INFO  00:49:10.835 [Lookup Metadata background worker 670] Exception in thread "Lookup Metadata background worker 670" java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lang" is null
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.media.video.metadata.TvSeriesMetadata.hasTranslation(TvSeriesMetadata.java:596)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.media.video.metadata.TvSeriesMetadata.getTranslation(TvSeriesMetadata.java:601)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.media.video.metadata.TvSeriesMetadata.getPoster(TvSeriesMetadata.java:624)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.database.MediaTableTVSeries.getTvSeriesMetadata(MediaTableTVSeries.java:780)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.database.MediaTableTVSeries.getTvSeriesMetadataFromTmdbId(MediaTableTVSeries.java:718)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.external.umsapi.APIUtils.setTVSeriesInfo(APIUtils.java:607)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at net.pms.external.umsapi.APIUtils.lambda$backgroundLookupAndAddMetadata$0(APIUtils.java:440)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO  00:49:10.835 [Lookup Metadata background worker 670]      at java.base/java.lang.Thread.run(Unknown Source)
The only language setting I can find is in the web configurator under application and it says it's set to "English / United States".

How can I set whatever language Java thinks it should be using in the String.toLowerCase() method that is constantly calling for some sort of metadata. Maybe metadata is failing to get any metadata (including filename) and thus there's nothing to sort with?

Re: Why: java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lang" is null

Posted: Mon Jun 17, 2024 1:30 pm
by wiegleyj
Adding "language = en-US" to the configuration file seems to fix it (at least it gets rid of the metadata workers throwing the exception I posted; sorting still isn't working at all.)

When you go through the web configuration interface it doesn't save important elements (such as language or sorting method) unless you change them, save, and then change them to the actual item you want and save again. It doesn't seem to assume any reasonable defaults even though the web interface displays a default.

Re: Why: java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lang" is null

Posted: Tue Jun 18, 2024 5:24 am
by mik_s
As you have found out the language option was not set so that function did not know how to handle requests to get metadata.

This should have been set when UMS is installed based on the system language, but I see you are on Linux and this might have been missed and left blank.

The language button on the top of the web interface is only changes the displayed language on the webpage.

To change the application language that setting is in the General settings > Application settings > Language

Sorting may or may not work depending on the renderer. My Samsung TV will ignore the sort order and display alphabetically no matter what I set it to.
The web player should show it in the order you specify so you can use this to see if it is working.

Re: Why: java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lang" is null

Posted: Wed Jun 19, 2024 8:26 pm
by fireculex
I am using Arch and came across this problem myself. In the debug.log it shows

Code: Select all

INFO  2024-06-19 08:12:10.749 [main] Language not specified, defaulting to OS language.
However this does not appear to be the case? It should show the OS language that has been detected and perhaps going so far as a hard stop if it's null.

Re: Why: java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "lang" is null

Posted: Tue Jul 02, 2024 6:41 pm
by SubJunk
Thanks for the reports. We have fixed this now and it will be released in the version after 14.2.0