Community
Participate
Working Groups
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.
Good catch! Fix to go in SurroundWithTryCatchRefactoring line 282. (Replace 'varName' with 'name')
Fixed in BETA_JAVA7
Verified in I20110729-1200 and M20110729-1400.