Re: NullPointException

So something on that line is null, 'tema' being the obvious candidate.
Since the line before this checks for that then all I can say is you aren't running the code you think you are.
I would suggest putting println()'s in there so you can see what's going on, or to step through in a debugger.

Re: NullPointException

Re: NullPointException

Have you made the changes suggested by cselic?
If so have you also stuck in some debugging to see what the values of everything are (and to check that what you are running is wht you think you are running)?