if (factory != null) { try { return factory.createTopicConnection(); } catch (JMSException e) { log.error(e.getMessage()); } } return null;
if (clazz != null && method != null){ // log.info("class " + clazz.getClass().getName() + // " method name is " + method); try { return clazz.getClass().getMethod(method,new Class[0]); } catch (NoSuchMethodException e) { log.warn(e.getMessage()); } } return null;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/ConnectionFactory.java File path: /jakarta-jmeter-2.3.2/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
Method name: TopicConnection getTopicConnection() Method name: Method getMethod(Object, String)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (factory != null) {
1
if (
2
			try {
3
				return factory.createTopicConnection();
4
			} catch (JMSException e) {
5
				log.error(e.getMessage());
6
			}
7
		}
8
		
2
clazz != null && method != null){
3
            // log.info("class " + clazz.getClass().getName() +
4
            //        " method name is " + method);
5
            try {
6
                return clazz.getClass().getMethod(method,new Class[0]);
7
            } catch (NoSuchMethodException e) {
8
                log.warn(e.getMessage());
9
            }
10
        }
9
return null;
11
        return null;
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.3
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 fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    javax.jms.JMSExceptionjava.lang.NoSuchMethodExceptionSUBCLASS_TYPE_MISMATCH
    javax.jms.JMSExceptionjava.lang.NoSuchMethodExceptionSUBCLASS_TYPE_MISMATCH
    errorwarnMETHOD_INVOCATION_NAME_MISMATCH
    javax.jms.JMSExceptionjava.lang.NoSuchMethodExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression log.error(e.getMessage()) is a void method call, and thus it cannot be parameterized
    Expression log.warn(e.getMessage()) is a void method call, and thus it cannot be parameterized
    2
    try
                                                                                                                        
    3
    return clazz.getClass().getMethod(method, new Class[0]);
    Preondition Violations
    Unmatched return clazz.getClass().getMethod(method,new Class[0]);
    3
    return clazz.getClass().getMethod(method, new Class[0]);
    3
    return factory.createTopicConnection();
    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();
                                                                                        
    Precondition Violations (5)
    Row Violation
    1Expression log.error(e.getMessage()) is a void method call, and thus it cannot be parameterized
    2Expression log.warn(e.getMessage()) is a void method call, and thus it cannot be parameterized
    3Unmatched return clazz.getClass().getMethod(method,new Class[0]);
    4Unmatched 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
    5Unmatched return factory.createTopicConnection();