while (itr.hasNext()) { Context ctx = (Context) MAP.get(itr.next()); try { ctx.close(); } catch (NamingException e) { log.error(e.getMessage()); } }
if (factory != null) { try { return factory.createTopicConnection(); } catch (JMSException e) { log.error(e.getMessage()); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/ConnectionFactory.java
Method name: void close() Method name: TopicConnection getTopicConnection()
Number of AST nodes: 4 Number of AST nodes: 3
1
while (itr.hasNext()) {
2
			Context ctx = (Context) MAP.get(itr.next());
3
			try {
4
				ctx.close
1
if (factory != null) {
2
			try {
5
();
3
				return factory.createTopicConnection();
6
			} catch (NamingException e) {
4
			} catch (JMSException e) {
7
				log.error(e.getMessage());
5
				log.error(e.getMessage());
8
			}
6
			}
9
		}
7
		}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    Context ctx = (Context)MAP.get(itr.next());
                                                                                            
    4
    try
    4
    try
    2
    try
    Differences
    Expression1Expression2Difference
    javax.naming.NamingExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    javax.naming.NamingExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    javax.naming.NamingExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    2
    try
                                                                                        
    3
    return factory.createTopicConnection();
    Preondition Violations
    Unmatched statement return factory.createTopicConnection(); 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
    Unmatched return factory.createTopicConnection();
    3
    return factory.createTopicConnection();
    5
    ctx.close();
    5
    ctx.close();
    Preondition Violations
    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
                                  
    Precondition Violations (3)
    Row Violation
    1Unmatched statement return factory.createTopicConnection(); 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
    2Unmatched return factory.createTopicConnection();
    3Unmatched 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