Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in iterating through files.

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please UseOneThreadPerQuestion. Let's continue in your previous thread.
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic