Help coderanch get a
new server
by contributing to the fundraiser

LeeAnn Sumner

Greenhorn
+ Follow
since May 09, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by LeeAnn Sumner

Thanks for your welcome! I'm glad to find such a friendly knowledgable community!
There are five elements in each line and four lines to the data file that I'm reading in. I'm trying to read each element from each line, assign it to a variable then pass it to the OrderWithCharge constructor to create an array of OrderWithCharge objects.
I think part of my problem was that I needed to process the whole buffer into an array of tokenized Strings to pass to the method that creates the order array instead of passing one String (one line) at a time, since it was only reading the first line and never moving on. At least I think that was my problem....right now I'm dealing with another infinite loop and a NullPointerException error in this code:

The error refers to three places: the line in my main method in another class that calls to the processOrderInFile method, the line where createOrderArray is called and passes the tokenArray, and the line where the item variable is defined in createOrderArray (item = token.nextToken() ;) .
I'm not sure what it means by NullPointerException...I'm thinking that somewhere my array is empty or something isn't lined up right, but I'm having a hard time knowing what to look for. Your help is most appreciated!
[ May 09, 2004: Message edited by: LeeAnn Sumner ]
20 years ago
I'm working on an extremely similar project for my class as well, and also running into a looping problem.
I'm trying to determine how BufferedReader's readLine method works...is it supposed to move to the next line in the buffer after each line is read? How can you determine the number of lines in a buffer to cycle through them?
Here's my code...it seems to be only reading the first line of my file and getting stuck there infinitely:
20 years ago