File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "exception" Watch "exception" New topic
Author

exception

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
com.dhl.auditdatamgr.exceptions.ParserException: A required field is missing.
at com.dhl.auditdatamgr.utils.AuditFileParser.parseFile(AuditFileParser.java:161)
at com.dhl.auditdatamgr.process.AuditDataHandler.main(AuditDataHandler.java:94)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 5
at com.dhl.auditdatamgr.utils.AuditFileParser.parseFile(AuditFileParser.java:76)
... 1 more

2)file content


3)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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: http://aspose.com/file-tools
 
subject: exception