Bug 134439 - quick fix: add catch clause adds clause in comment, if block is followed by comment
Summary: quick fix: add catch clause adds clause in comment, if block is followed by c...
Status: RESOLVED DUPLICATE of bug 95839
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.2   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-02 23:31 EDT by Philippe Ombredanne CLA
Modified: 2006-04-05 10:33 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Ombredanne CLA 2006-04-02 23:31:51 EDT
Sample method:

import java.io.File;
import java.net.MalformedURLException;
public class TestClass {
 void somemethod() {
  File f = new File("", "");
  try {
   f.toURL();
   File.createTempFile("", "");
  } catch (MalformedURLException e) {
   e.printStackTrace();
  }
  // some comment
 }
}


If you load that code in Eclipse, there will be red squiggle under the createTempFile line and a proposed quick fix "add catch clause to surrounding try" . If you select that quick fix, you end up wiuth the following incorrect output, where the newly generated catch cluase has been added ad the end of the //some comment line:

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
public class TestClass {
 void somemethod() {
  File f = new File("", "");
  try {
   f.toURL();
   File.createTempFile("", "");
  } catch (MalformedURLException e) {
   e.printStackTrace();
  }
  // some comment catch (IOException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
 }
}
Comment 1 Martin Aeschlimann CLA 2006-04-05 10:33:56 EDT
reason is bug 95839

*** This bug has been marked as a duplicate of 95839 ***