jQuery in Action, 2nd edition*
The moose likes I/O and Streams and the fly likes Writing CSV File from Database Generates Null Pointer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Writing CSV File from Database Generates Null Pointer" Watch "Writing CSV File from Database Generates Null Pointer" New topic
Author

Writing CSV File from Database Generates Null Pointer

Scott Florez
Ranch Hand

Joined: Dec 05, 2006
Posts: 58
Hi everyone. I am using the code below to write the contents of a SQL database to a CSV file. However, every time I run it, regardless of the database content, I get a null pointer error somewhere in a record in the 800s range (and the file write stops). Since it produces the same error with different data, I'm pretty sure that the problem is not in the database content. Can you take a look and see if you have any ideas? Thanks!

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Run it again, and this time look carefully at the stack trace. It will tell you the line number where the error occurs. Look there.

However, having said that, if you are going to test whether MainMenu.rs is null, surely you should do that before this line of code:
Scott Florez
Ranch Hand

Joined: Dec 05, 2006
Posts: 58
This line is causing the null pointer:



Also, the null pointer is not always in a record in the 800s range, as I just produced the error in the 500s range.
[ April 10, 2007: Message edited by: Scott Florez ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing CSV File from Database Generates Null Pointer