Meaningless Drivel is fun!
The moose likes I/O and Streams and the fly likes exception 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 "exception" Watch "exception" New topic


arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi follwoing is the file.Now problem is this file is reading data from a text file which has contents as follows
Now even though I am able to print all values in file still it is giving exception .

1)exception A required field is missing.
Caused by: java.lang.ArrayIndexOutOfBoundsException: 5
... 1 more

2)file content

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Well, the obvious answer is that the regex you're actually using is splitting the String into 5 or fewer pieces. We don't see the regex here, so we can't comment on whether it works. But this sure is a lot of code to show us just for that! Why not just write a tiny test program and use it to refine your regex -- whatever it is -- until it breaks each line into the right number of pieces?

Barring that, add some debug-printing code which shows what the offending line was and what the tokens were.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: exception
It's not a secret anymore!