java.lang.NullPointerException

All your suggestions, requests and ideas for future development
Post Reply
joshua
Posts: 12
Joined: 14 Dec 2013, 14:26

java.lang.NullPointerException

Post by joshua »

Hi,

Filebot version 3.8 (lastest)

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

(I removed all the non-essential for the purpose of this bug report) I used this as the format line :

Code: Select all

{def db = net.sourceforge.filebot.WebServices.TheTVDB; db.getEpisodeList(db.search(n)[0], null, Locale.FRENCH).find{episode.season == it.season && episode.episode == it.episode}.title}
When i tried to fetch data with the file "supernatural.3x01.avi" i have this on the "New names" side :

Code: Select all

 [java.lang.NullPointerException] Supernatural - 3x01 - The Magnificent Seven
I tested with Locale.ENGLISH/Locale.getDefault() and i still get the same exception. And with all the "Episode Mode" : TheTVDB, TVRage, AniDB.

Note : The expression

Code: Select all

{t}
returns the title correctly (in english), but i need it in french.

Is this a known bug ? Or am i doing something wrong?

If you need more details i will try to be as clear as possible!

Regards
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: java.lang.NullPointerException

Post by rednoah »

It's not a bug if it's in your code. :P

So if you need the title in French, why don't you set "Preferred Language" to French so {t} is just French? If you'd still like {n} to be in English you can use {primaryTitle}



The issue is that the hack above is not reliable, and when back-referencing by series name it comes up with different results from a series with the same name from 1977, which doesn't have that episode, so you get back null when you try to get the title.

Search for Supernatural, get back Supernatural 1977 ... Bad luck:

Code: Select all

{def db = net.sourceforge.filebot.WebServices.TheTVDB; db.getEpisodeList(db.search(n)[0], null, Locale.FRENCH)}
This works for TheTVDB if {series} is a TheTVDB object:

Code: Select all

{def db = net.sourceforge.filebot.WebServices.TheTVDB; db.getEpisodeList(series, null, Locale.FRENCH)}
:idea: Please read the FAQ and How to Request Help.
joshua
Posts: 12
Joined: 14 Dec 2013, 14:26

Re: java.lang.NullPointerException

Post by joshua »

Thanks a lot ! Problem solved.

I didn't know about "{primaryTitle}" this i why i used English as preferred language to have the serie name in english, but i wanted the episode name in french.

Thanks again! :D
joshua
Posts: 12
Joined: 14 Dec 2013, 14:26

Re: java.lang.NullPointerException

Post by joshua »

I think i have the same problem with the serie year.

I used the code you provided :

Code: Select all

{episodelist.findAll{it.season == s}.airdate.year[0,-1].unique().join('-')}
But i think i'm still on the Supernatural 1977 for "episodelist" because the airdate array seems to be empty.

Code: Select all

[java.lang.ArrayIndexOutOfBoundsException: Negative array index [-1] too large for array size 0] Supernatural - 3x01 - The Magnificent Seven
I tried to use this :

Code: Select all

{def db = net.sourceforge.filebot.WebServices.TheTVDB; db.getEpisodeList(series, null, Locale.getDefault()).find{episode.season == it.season}.airdate.year[0,-1].unique().join('-')}
But i'm getting a error "No signature method..."

It's really hard sometimes to get a little bit "out-of-the-box". (It's not a complain! I really love Filebot i use it everyday!).
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: java.lang.NullPointerException

Post by rednoah »

Haha, this one is hard because it's not supported. :D

Try the {episodelist} binding in r1968+ for better results.

You made a mistake in your expression. This works:

Code: Select all

{def db = net.sourceforge.filebot.WebServices.TheTVDB; db.getEpisodeList(series, null, Locale.getDefault()).findAll{episode.season == it.season}.airdate.year[0,-1].unique().join('-')}
You can't get first and last year if you're just selecting a single episode.
:idea: Please read the FAQ and How to Request Help.
joshua
Posts: 12
Joined: 14 Dec 2013, 14:26

Re: java.lang.NullPointerException

Post by joshua »

Thanks again, works perfectly! (as always :) )
Post Reply