if (clazz != null){ // log.info("class " + clazz.getClass().getName() + // " method name is " + RUNTEST); try { Class[] param = {TestResult.class}; return clazz.getClass().getMethod(RUNTEST,param); } catch (NoSuchMethodException e) { log.warn(e.getMessage()); } } return null;
if (factory != null) { try { return qfactory.createQueueConnection(); } catch (JMSException e) { log.error(e.getMessage()); } } return null;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/ConnectionFactory.java
Method name: Method getRunTestMethod(Object) Method name: QueueConnection getQueueConnection(Context, String)
Number of AST nodes: 5 Number of AST nodes: 4
1
if (clazz != null){
1
if (factory != null) {
2
            // log.info("class " + clazz.getClass().getName() +
3
            //        " method name is " + RUNTEST);
4
            try {
5
                Class[] param = {TestResult.class};
6
                return clazz.getClass().getMethod(RUNTEST,param);
7
            } catch (NoSuchMethodException e) {
8
                log.warn(e.getMessage());
9
            }
10
        }
11
        
2
			try {
3
				return qfactory.createQueueConnection();
4
			} catch (JMSException e) {
5
				log.error(e.getMessage());
6
			}
7
		}
12
return null;
8
		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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (clazz != null)
    1
    if (clazz != null)
    1
    if (factory != null)
    Differences
    Expression1Expression2Difference
    clazzfactoryVARIABLE_NAME_MISMATCH
    java.lang.Objectjavax.jms.TopicConnectionFactoryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable clazz does not match with type javax.jms.TopicConnectionFactory of variable factory
    • Make classes java.lang.Object and javax.jms.TopicConnectionFactory extend a common superclass
    1
    if (factory != null)
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.lang.NoSuchMethodExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.NoSuchMethodExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    warnerrorMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.NoSuchMethodExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression log.warn(e.getMessage()) 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
    2
    try
                                                                                          
    3
    return qfactory.createQueueConnection();
    Preondition Violations
    Unmatched statement return qfactory.createQueueConnection(); 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 qfactory.createQueueConnection();
    3
    return qfactory.createQueueConnection();
    3
    Class[] param = {TestResult.class};
                                                                            
    4
    return clazz.getClass().getMethod(RUNTEST, param);
    4
    return clazz.getClass().getMethod(RUNTEST, param);
    Preondition Violations
    Unmatched return clazz.getClass().getMethod(RUNTEST,param);
                                                                                                            
    5
    return null;
    4
    return null;
    Precondition Violations (6)
    Row Violation
    1Type java.lang.Object of variable clazz does not match with type javax.jms.TopicConnectionFactory of variable factory
    2Expression log.warn(e.getMessage()) 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 return qfactory.createQueueConnection(); 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 qfactory.createQueueConnection();
    6Unmatched return clazz.getClass().getMethod(RUNTEST,param);