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

For help and support with Universal Media Server
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply
Post Reply
wiegleyj
Posts: 16
Joined: Fri May 08, 2015 2:32 pm

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

Post 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?
Attachments
ums_dbg_2024-06-17-00-48.zip
(888.2 KiB) Downloaded 804 times
wiegleyj
Posts: 16
Joined: Fri May 08, 2015 2:32 pm

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

Post 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.
User avatar
mik_s
Moderator
Posts: 1445
Joined: Wed Aug 23, 2017 11:03 pm
Location: UK

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

Post 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.
Logs are important for us to help, Please follow This Link before asking for support. Just a forum cleaner, Will help if I can but no expert.
fireculex
Posts: 1
Joined: Mon Mar 28, 2022 6:00 am

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

Post 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.
User avatar
SubJunk
Lead Developer
Posts: 3804
Joined: Sun May 27, 2012 4:12 pm

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

Post by SubJunk »

Thanks for the reports. We have fixed this now and it will be released in the version after 14.2.0
Post Reply