diff --git a/src/gr/uom/java/jdeodorant/refactoring/manipulators/ExtractMethodFragmentRefactoring.java b/src/gr/uom/java/jdeodorant/refactoring/manipulators/ExtractMethodFragmentRefactoring.java index 9d0a816b..afc7498a 100644 --- a/src/gr/uom/java/jdeodorant/refactoring/manipulators/ExtractMethodFragmentRefactoring.java +++ b/src/gr/uom/java/jdeodorant/refactoring/manipulators/ExtractMethodFragmentRefactoring.java @@ -338,7 +338,7 @@ else if(controlDependence.isFalseControlDependence()) { PDGControlPredicateNode dstPredicateNode = (PDGControlPredicateNode)dstPDGNode; listRewrite.insertLast(processPredicateNode(dstPredicateNode, ast, sourceRewriter, sliceNodes), null); } - else { + else if(!tryStatementBodyRewriteMap.containsKey(dstPDGNode.getASTStatement())) { processStatementNode(listRewrite, dstPDGNode, ast, sourceRewriter); sliceNodes.remove(dstPDGNode); } @@ -366,7 +366,7 @@ else if(trueControlDependentChildren.size() == 1) { PDGControlPredicateNode dstPredicateNode = (PDGControlPredicateNode)dstPDGNode; listRewrite.insertLast(processPredicateNode(dstPredicateNode, ast, sourceRewriter, sliceNodes), null); } - else { + else if(!tryStatementBodyRewriteMap.containsKey(dstPDGNode.getASTStatement())) { processStatementNode(listRewrite, dstPDGNode, ast, sourceRewriter); sliceNodes.remove(dstPDGNode); } @@ -404,7 +404,7 @@ else if(oldPredicateStatement instanceof SwitchStatement) { PDGControlPredicateNode dstPredicateNode = (PDGControlPredicateNode)dstPDGNode; bodyRewrite.insertLast(processPredicateNode(dstPredicateNode, ast, sourceRewriter, sliceNodes), null); } - else { + else if(!tryStatementBodyRewriteMap.containsKey(dstPDGNode.getASTStatement())) { processStatementNode(bodyRewrite, dstPDGNode, ast, sourceRewriter); sliceNodes.remove(dstPDGNode); }