Project: JDT
Bug 31379 Surround with try/catch should use unique identifier for exception
Reported: 2003-02-07 17:10:38 | Status: resolved fixed

Build id: 200302061700 Surround with try/catch should avoid collision with existing identifiers when declaring the catch-block variable. For the following code snippet: try { throw new Exception(); } catch (Exception e) { throw new Exception(); // <<== problem marker } When accepting the quick-fix suggested for the problematic line, the following code results: try { throw new Exception(); } catch (Exception e) { try { throw new Exception(); } catch (Exception e) { // <<== problem marker // TODO Auto-generated catch block e.printStackTrace(); } } Now there is a compiler error in the inner catch: "Duplicate argument e".

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/SurroundWithWorkSpace/SurroundWithTests/trycatch_in/TestNested.java org.eclipse.jdt.ui.tests.refactoring/resources/SurroundWithWorkSpace/SurroundWithTests/trycatch_out/TestNested.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/SurroundWithTests.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/TryCatchBlock.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/CodeScopeBuilder.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallContext.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CodeScopeBuilder.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/SourceProvider.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/surround/SurroundWithTryCatchAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/surround/SurroundWithTryCatchRefactoring.java