Bookmark Topic Watch Topic
  • New Topic

problem in iterating through files.

 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please UseOneThreadPerQuestion. Let's continue in your previous thread.
 
    Bookmark Topic Watch Topic
  • New Topic