aspose file tools*
The moose likes Beginning Java and the fly likes help me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help me" Watch "help me" New topic
Author

help me

Silly Boy
Greenhorn

Joined: Apr 06, 2005
Posts: 1


i got error msg:
exception in thread "main" java.lang.ArrayIndexOutOfBoundException:1000
Record.Save(Record.java:238)

how to fix it ya??

[ April 06, 2005: Message edited by: Silly Boy ]
[ April 06, 2005: Message edited by: Mark Spritzler ]
Sudharsan Govindarajan
Ranch Hand

Joined: Jul 03, 2002
Posts: 319


Joy is a radiation
Jeff Jetton
Ranch Hand

Joined: Mar 29, 2005
Posts: 71
Originally posted by Silly Boy:

i got error msg:
exception in thread "main" java.lang.NullPointerException
Record.Save(Record.java:238)

how to fix it ya??


Notice that the error message is referring to line #238, and that it's in your Save method of the Record class. Now, I don't know which line is 238 in your file, since you just posted the Save method, but once you figure that out, you're halfway there--the error will be on or near that line.

Second, the error is a NullPointerException. So head to the docs and take a look at what that means. I'm guessing that it's probably the second cause they list. So look for a case near line 238 where you're assigning something that might turn out to really be "null". It helps to ask yourself things like, "What is this line of code doing?" "Is it doing what I think it's doing?" "Are these variables and objects representing what I think they're representing?"

Third, I really didn't bother wading though your code too much because, well, it's kind of a mess. If you post your code with "CODE" tages around it, that will preserve the indenting, and make it a whole lot more readable.

Good luck ya??

- Jeff
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Mr. Boy,

Welcome to JavaRanch!

You may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. "Handles" aren't acceptable. You can change your display name here. Thanks!


[Jess in Action][AskingGoodQuestions]
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
"Silly Boy" -

You have got to be kidding here. Please read the JavaRanch FAQ, where you'll find a discussion on how to ask a question, including how to include only relevant portions of your code (not the whole thing), how to tell us what error you see, what you've done to try to fix it, and to clearly ask one or two relevant questions. You'll get a lot more willing help that way.


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

How did the error change from a NullPointerException to an ArrayIndexOutOfBoundsException.

As far the new error, maybe it is simple becausel your array does not have up to 1000 elements.

try to change



to have the "for" line say

for (x = 0; x < Record.length; x++) {

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help me