• Post Reply 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

read lines after exception

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am reading a file line by line...But in some case some exception comes,i catch exception but program not exceute next line. please tell how skip the exception comes on line and exceute next line.I used this but it shows compilation error
finally{
continue;
}
but it shows compilation error
try {


FileInputStream fstream = new FileInputStream(args[0]);
log");
System.out.println(fstream);
FileOutputStream fstream1 = new FileOutputStream("C://Documents and Settings/sp0c5899/Desktop/msgtracking.log");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
DataOutputStream out = new DataOutputStream(fstream1);
BufferedWriter br1 = new BufferedWriter(new OutputStreamWriter(out));
try {

System.out.println("Line 1 : " + lin);


while ((line = br.readLine()) !=null)
{

some condition checking

}
catch (Exception e) {//Catch exception if any
System.err.println("Error: " + e);
e.printStackTrace();



}


} catch (Exception e) {//Catch exception if any
System.err.println("Error: " + e);
}
finally{
continue;
}
}
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make the try block "smaller" -- put it inside the while loop, rather than outside of it.
 
SHINU .R SHINU .R
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it possible to exceute continue on finally block
 
reply
    Bookmark Topic Watch Topic
  • New Topic