while (iter.hasNext()) { try { set.add(iter.next()); } catch (Exception err) { log.error("", err); } }
while (itr.hasNext()) { Context ctx = (Context) MAP.get(itr.next()); try { ctx.close(); } catch (NamingException e) { log.error(e.getMessage()); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java
Method name: Set getAction(String) Method name: void close()
Number of AST nodes: 3 Number of AST nodes: 4
1
while (iter.hasNext()) {
1
while (itr.hasNext()) {
2
			try {
2
			
3
				set.add(iter.next());
3
Context ctx = (Context) MAP.get(itr.next());
4
			
4
			try {
5
				ctx.close();
5
} catch (Exception err) {
6
			} catch (NamingException e) {
6
				log.error("", err);
7
				log.error(e.getMessage());
7
			}
8
			}
8
		}
9
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    while (iter.hasNext())
    4
    while (iter.hasNext())
    2
    while (itr.hasNext())
    Differences
    Expression1Expression2Difference
    iteritrVARIABLE_NAME_MISMATCH
    2
    while (itr.hasNext())
                                                                                            
    3
    Context ctx = (Context)MAP.get(itr.next());
    Preondition Violations
    Unmatched statement Context ctx=(Context)MAP.get(itr.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    Context ctx = (Context)MAP.get(itr.next());
    5
    try
    5
    try
    4
    try
    Differences
    Expression1Expression2Difference
    java.lang.Exceptionjavax.naming.NamingExceptionSUBCLASS_TYPE_MISMATCH
    erreVARIABLE_NAME_MISMATCH
    java.lang.Exceptionjavax.naming.NamingExceptionSUBCLASS_TYPE_MISMATCH
    log.error("",err)log.error(e.getMessage())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression log.error("",err) is a void method call, and thus it cannot be parameterized
    Expression log.error(e.getMessage()) is a void method call, and thus it cannot be parameterized
    4
    try
                                  
    5
    ctx.close();
    Preondition Violations
    Unmatched statement ctx.close(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement ctx.close(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5
    ctx.close();
    6
    set.add(iter.next());
    6
    set.add(iter.next());
    Preondition Violations
    Unmatched statement set.add(iter.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    Precondition Violations (6)
    Row Violation
    1Unmatched statement Context ctx=(Context)MAP.get(itr.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression log.error("",err) is a void method call, and thus it cannot be parameterized
    3Expression log.error(e.getMessage()) is a void method call, and thus it cannot be parameterized
    4Unmatched statement ctx.close(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement ctx.close(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched statement set.add(iter.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted