| Author |
java.lang.NullPointerException
|
Dorota Rupniewska
Greenhorn
Joined: Jan 09, 2011
Posts: 2
|
|
Hello 2 All
My code is really simple, but I get java.lang.NullPointerException
and table sale_daty:
fDate is a parameter (Date). fSala is Integer.
All I want is to check if fDate is already in database. If yes, then check if idSali from this recordset = fSala
Is anyone can help?
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2350
|
|
Welcome to the Ranch, Dorata.
At which line is the Exception thrown?
|
OCUP UML fundamental
ITIL foundation
|
 |
Tom Reilly
Rancher
Joined: Jun 01, 2010
Posts: 618
|
|
|
It would help if you post all of your code rather than just snippets and post the full exception trace that says which line of code is causing the NPE. Do you know how to do that? Otherwise, we can only guess. My guess is that either the variable(s) conn or fDate has not been initialized.
|
 |
Ronald Djunaedi
Greenhorn
Joined: Jan 06, 2011
Posts: 5
|
|
Hi Dorota, i hope you dont mind to post a full exception output, since it's hard enough to identify the problem only with the code you posted here...
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
Welcome to JavaRanch Dorota Rupniewska
Please don't write things like "2" for "to".
|
 |
Dorota Rupniewska
Greenhorn
Joined: Jan 09, 2011
Posts: 2
|
|
It's bigger project but I try explain It better:
I have a calendar in a JSP page:
When user change month, days which are in database should be marked red. The rest of my code:
This function always return true so all days are marked red.
To find what's wrong I've changed and shorted this code to:
This short code work fine and there is no NPE. I guess the parameter fDate wasn't in proper format.
Thank you for help
P.S.
Please don't write things like "2" for "to".
ok, I won't do this again
|
 |
 |
|
|
subject: java.lang.NullPointerException
|
|
|