if(channel != null) { try { channel.close(); } catch(IOException iex) { log.debug("Error closing channel",iex); } }
if (factory != null) { try { return qfactory.createQueueConnection(); } 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/http/sampler/AjpSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/ConnectionFactory.java
Method name: void threadFinished() Method name: QueueConnection getQueueConnection(Context, String)
Number of AST nodes: 3 Number of AST nodes: 3
1
if(channel != null) {
1
if (factory != null) {
2
            try {
3
            channel.close();
4
            
2
			try {
3
				return qfactory.createQueueConnection();
5
} catch(IOException iex) {
4
			} catch (JMSException e) {
6
            log.debug("Error closing channel",iex);
7
            }
8
        
5
				log.error(e.getMessage());
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.4
Clones locationClones are in different classes
Number of node comparisons5
  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 fragment1
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (channel != null)
    1
    if (channel != null)
    1
    if (factory != null)
    Differences
    Expression1Expression2Difference
    channelfactoryVARIABLE_NAME_MISMATCH
    java.net.Socketjavax.jms.TopicConnectionFactoryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.Socket of variable channel does not match with type javax.jms.TopicConnectionFactory of variable factory
    • Make classes java.net.Socket and javax.jms.TopicConnectionFactory extend a common superclass
    1
    if (factory != null)
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.io.IOExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    iexeVARIABLE_NAME_MISMATCH
    java.io.IOExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    debugerrorMETHOD_INVOCATION_NAME_MISMATCH
    log.debug("Error closing channel",iex)log.error(e.getMessage())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression log.debug("Error closing channel",iex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.error(e.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.debug("Error closing channel",iex) 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
    Expression log.debug("Error closing channel",iex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.error(e.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.debug("Error closing channel",iex) 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
    channel.close();
    3
    channel.close();
    Preondition Violations
    Unmatched statement channel.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement channel.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 (13)
    Row Violation
    1Type java.net.Socket of variable channel does not match with type javax.jms.TopicConnectionFactory of variable factory
    2Expression log.debug("Error closing channel",iex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression log.error(e.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression log.debug("Error closing channel",iex) is a void method call, and thus it cannot be parameterized
    5Expression log.error(e.getMessage()) is a void method call, and thus it cannot be parameterized
    6Expression log.debug("Error closing channel",iex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression log.error(e.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression log.debug("Error closing channel",iex) is a void method call, and thus it cannot be parameterized
    9Expression log.error(e.getMessage()) is a void method call, and thus it cannot be parameterized
    10Unmatched 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
    11Unmatched return qfactory.createQueueConnection();
    12Unmatched statement channel.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    13Unmatched statement channel.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