File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes i need to skip lines after exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "i need to skip lines after exception" Watch "i need to skip lines after exception" New topic

i need to skip lines after exception


Joined: Sep 02, 2005
Posts: 12
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
but it shows compilation error
try {

FileInputStream fstream = new FileInputStream(args[0]);
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);


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

Joined: Jul 23, 2001
Posts: 177
1.) You have posted in the wrong forum. Try this forum
2.) The moderators are going to ask you to change you login name, since it does not follow javaranch policy.
3.) Comment out the continue in the finally block and if you wish to ignore an exception, you can do this by not handling it by just having empty braces.

Hope this helps!

[ November 12, 2006: Message edited by: Harsha Jay ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61106

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: i need to skip lines after exception