Results 1 to 6 of 6
- 05-08-2012, 02:11 AM #1
Member
- Join Date
- May 2012
- Posts
- 3
- Rep Power
- 0
loading file data into arraylist...
Hi, im trying to load data from a file, created by my project, back into my project. My load function code is:
myFile.showOpenDialog(this);
path = myFile.getSelectedFile().getPath();
try
{
ObjectInputStream in = new ObjectInputStream(new FileInputStream(path));
txtMessage.append("Error Checking 1...\n");//Error checking...
myInput.cameraList = (ArrayList<String>)in.readObject();
txtMessage.append("Error Checking 2...\n");//Error checking...
txtMessage.append("Loading\n");
txtMessage.append("Loaded camera data from file... " + myInput.cameraList+"\n");
}
catch (Exception err2)
{
txtMessage.append("Error loading data... "+err2.getMessage()+"\n");
}
I am given this message: "Error loading data... null"
I have error checking as you can see, the line of code that its getting stuck on is the line just after "Error checking... 1". Im not sure whats wrong though, im not getting any complie errors...
- 05-08-2012, 02:23 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,604
- Rep Power
- 5
Re: loading file data into arraylist...
The printStackTrace method is invaluable in determining the true exception and the underlying problem. I recommend using this (or a form of it) to get the full stack trace of the exception.
- 05-08-2012, 02:25 AM #3
Member
- Join Date
- May 2012
- Posts
- 3
- Rep Power
- 0
- 05-08-2012, 02:30 AM #4
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,604
- Rep Power
- 5
Re: loading file data into arraylist...
Post the entirety of the result from the above in the catch statementcatch (Exception err2)
{
err2.printStackTrace();
}
- 05-08-2012, 02:35 AM #5
Member
- Join Date
- May 2012
- Posts
- 3
- Rep Power
- 0
Re: loading file data into arraylist...
I put it into my code, it came up underlined in yellow and said "Throwable.printStackTrace(); should be removed". i tried running it anyway but it didnt display an error message.
p.s. im in doing this in netbeans, if it makes any difference...
- 05-08-2012, 03:06 AM #6
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,604
- Rep Power
- 5
Re: loading file data into arraylist...
I have no idea what that means, and you didn't post updated code of what you did...so one can only guess. I suggest you read upon on Exceptions handling:
Lesson: Exceptions (The Java™ Tutorials > Essential Classes)
Similar Threads
-
loading data from a text file
By newbie123 in forum JDBCReplies: 1Last Post: 06-21-2011, 06:09 PM -
Extract data from file and store into separate ArrayList
By pawarkomal in forum New To JavaReplies: 4Last Post: 01-11-2011, 03:31 PM -
Load data from file to ArrayList
By humbug in forum New To JavaReplies: 3Last Post: 01-05-2011, 11:53 AM -
loading data in memory
By robby14 in forum Advanced JavaReplies: 10Last Post: 04-18-2010, 02:29 PM -
Storing data from text file in ArrayList
By tjhodge in forum New To JavaReplies: 1Last Post: 02-12-2009, 01:22 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks