Set a breakpoint after the 'line.split' and then examine what the fields array is holding.
String fields = line.split(";"); pInsOrd.setInt(0, Integer.parseInt(fields)); // CompanyID pInsOrd.setInt(1, Integer.parseInt(fields)); // ClientID pInsOrd.setDate(2, Date.valueOf(fields)); // SearchDate pInsOrd.executeUpdate();
Set a breakpoint after the 'line.split' and then examine what the fields array is holding.Fields array is holding correct values: 0=1, 1=88894, 2=2011-05-17
Then use the 'evaluate expression' window to manually evaluate 'Integer.parseInt(fields) and see what you get.
I just cut-n-pasted the error message into a text box:I opened my file with the notepad++ and mark the option to show all hidden characters and there is none, just 1;88894;2011-05-17
and in a simple text box, there is a non-printing character in front of the 1:
baftos wrote:I've used WinVi editor and in ANSI I could see hidden characters. I delete them, saved and run my java code again and IT WORKED!
Copy this line from your original post:
java.lang.NumberFormatException: For input string: "1"
Open a command prompt and paste it there. There is something before the 1.
Paste it in notepad. Try to save. It will tell you that you lose information if you save in ANSI and suggest you use Unicode. Do it.
With a hex editor, you will see an FFFE just before the 1.
According to http://en.wikipedia.org/wiki/Unicode, FFFE "conveys the zero-width no-break space (a character with no appearance and no effect other than [...]", whatever this means.
Edited by: baftos on Mar 22, 2013 7:20 PM