if(channel != null) { try { channel.close(); } catch(IOException iex) { log.debug("Error closing channel",iex); } }
if (session != null) { try { session.close(); } catch (JMSException e) { LOGGER.info(e.getLocalizedMessage()); } }
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/sampler/JMSSampler.java
Method name: void threadFinished() Method name: void threadFinished()
Number of AST nodes: 3 Number of AST nodes: 3
1
if(channel != null) {
1
if (session != null) {
2
            try {
3
            channel.close();
4
            
2
			try {
3
				session.close();
5
} catch(IOException iex) {
4
			} catch (JMSException e) {
6
            log.debug("Error closing channel",iex);
7
            }
8
        
5
				LOGGER.info(e.getLocalizedMessage());
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (channel != null)
    1
    if (channel != null)
    2
    if (session != null)
    Differences
    Expression1Expression2Difference
    channelsessionVARIABLE_NAME_MISMATCH
    java.net.Socketjavax.jms.QueueSessionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.Socket of variable channel does not match with type javax.jms.QueueSession of variable session
    • Make classes java.net.Socket and javax.jms.QueueSession extend a common superclass
    2
    if (session != null)
    2
    try
    2
    try
    3
    try
    Differences
    Expression1Expression2Difference
    java.io.IOExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    iexeVARIABLE_NAME_MISMATCH
    java.io.IOExceptionjavax.jms.JMSExceptionSUBCLASS_TYPE_MISMATCH
    debuginfoMETHOD_INVOCATION_NAME_MISMATCH
    logLOGGERVARIABLE_NAME_MISMATCH
    log.debug("Error closing channel",iex)LOGGER.info(e.getLocalizedMessage())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression log.debug("Error closing channel",iex) is a void method call, and thus it cannot be parameterized
    Expression LOGGER.info(e.getLocalizedMessage()) is a void method call, and thus it cannot be parameterized
    Expression log.debug("Error closing channel",iex) is a void method call, and thus it cannot be parameterized
    Expression LOGGER.info(e.getLocalizedMessage()) is a void method call, and thus it cannot be parameterized
    3
    try
    3
    channel.close();
    3
    channel.close();
    4
    session.close();
    Differences
    Expression1Expression2Difference
    channelsessionVARIABLE_NAME_MISMATCH
    java.net.Socketjavax.jms.QueueSessionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.Socket of variable channel does not match with type javax.jms.QueueSession of variable session
    • Make classes java.net.Socket and javax.jms.QueueSession extend a common superclass
    4
    session.close();
    Precondition Violations (6)
    Row Violation
    1Type java.net.Socket of variable channel does not match with type javax.jms.QueueSession of variable session
    2Expression log.debug("Error closing channel",iex) is a void method call, and thus it cannot be parameterized
    3Expression LOGGER.info(e.getLocalizedMessage()) is a void method call, and thus it cannot be parameterized
    4Expression log.debug("Error closing channel",iex) is a void method call, and thus it cannot be parameterized
    5Expression LOGGER.info(e.getLocalizedMessage()) is a void method call, and thus it cannot be parameterized
    6Type java.net.Socket of variable channel does not match with type javax.jms.QueueSession of variable session