This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception

 
arjun rampal
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic