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
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.