aspose file tools*
The moose likes Java in General and the fly likes problem in iterating through files. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

problem in iterating through files.

Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Hi all,

I have two files Error_Messages_latest_Demo.txt and Error_Rules_Demo.txt.First one contains Error Messages and second one contains Error Rules.Error rules have to be picked from Error_Rules_Demo.txt one-by-one and have to be mapped to Error_Messages_latest_Demo.txt to check whether if there are more than one Error Messages corresponding to one Error Rule.
Below are given the content of both files.

Error_Messages_latest_Demo.txt

ERROR_CODE,ERROR_RULE
1000,AZK43:GHJXH2:The script failed to complete. See log file for details.
1002,A21:B35:I failed to perform.


Error_Rules_Demo.txt

ERROR_CODE,ERROR_RULE
1000,^[A-Z0-9_]+:[A-Z0-9_]+:The script failed to complete. See log file for details.$
1002,^[A-Z0-9]+:[A-Z0-9]+:I failed to perform.$


My program is given below.


Output:


AZK43:GHJXH2:The script failed to complete. See log file for details.
Error in reading file from specified path String index out of range: -1


It is printing only one line according to matched pattern.after that it is throwing exception.what should I supposed to do?Please reply.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Please UseOneThreadPerQuestion. Let's continue in your previous thread.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in iterating through files.