| Summary: | [1.7] Surround with try/multi-catch uses different variable names | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ayushman Jain <amj87.iitr> |
| Component: | UI | Assignee: | Deepak Azad <deepakazad> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | trivial | ||
| Priority: | P3 | CC: | daniel_megert, deepakazad |
| Version: | 3.7 | ||
| Target Milestone: | 3.7.1 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Good catch! Fix to go in SurroundWithTryCatchRefactoring line 282. (Replace 'varName' with 'name') Fixed in BETA_JAVA7 Verified in I20110729-1200 and M20110729-1400. |
BETA_JAVA7 class Test{ public static void main(String[] args) throws IOException{ boolean b = true; // selection start if (b) throw new FileNotFoundException(); else throw new ClassNotFoundException(); //selection end try { } catch (ClassNotFoundException e) { } catch (AssertionError e1) { } } } Selecting from the if(b) to the throw new IOException statement and choosing Surround with> Try/multi catch gives the following output try { if (b) throw new FileNotFoundException(); else throw new ClassNotFoundException(); } catch (ClassNotFoundException e2) { // TODO Auto-generated catch block e.printStackTrace(); } Notice the use of e2 in catch expression and e inside catch body. This works fine with surround with try/catch.