try { ConnectionFactory.getTopicConnectionFactory(ctx,connfactory); this.CONN = ConnectionFactory.getTopicConnection(); this.TOPIC = InitialContextFactory.lookupTopic(ctx, topic); this.SESSION = this.CONN.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE); this.PUBLISHER = this.SESSION.createPublisher(this.TOPIC); log.info("created the topic connection successfully"); } catch (JMSException e) { log.error("Connection error: " + e.getMessage()); }
try { ConnectionFactory.getTopicConnectionFactory(ctx,connfactory); this.CONN = ConnectionFactory.getTopicConnection(); this.TOPIC = InitialContextFactory.lookupTopic(ctx, topic); this.SESSION = this.CONN.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE); this.SUBSCRIBER = this.SESSION.createSubscriber(this.TOPIC); log.info("created the topic connection successfully"); } catch (JMSException e) { log.error("Connection error: " + e.getMessage()); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/Publisher.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jms/client/ReceiveSubscriber.java
Method name: void initConnection(Context, String, String) Method name: void initConnection(Context, String, String)
Number of AST nodes: 7 Number of AST nodes: 7
1
try {
1
try {
2
			ConnectionFactory.getTopicConnectionFactory(ctx,connfactory);
2
			ConnectionFactory.getTopicConnectionFactory(ctx,connfactory);
3
			this.CONN = ConnectionFactory.getTopicConnection();
3
			this.CONN = ConnectionFactory.getTopicConnection();
4
			this.TOPIC = InitialContextFactory.lookupTopic(ctx, topic);
4
			this.TOPIC = InitialContextFactory.lookupTopic(ctx, topic);
5
			this.SESSION = this.CONN.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
5
			this.SESSION = this.CONN.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
6
			this.PUBLISHER = this.SESSION.createPublisher(this.TOPIC);
6
			this.SUBSCRIBER = this.SESSION.createSubscriber(this.TOPIC);
7
			log.info("created the topic connection successfully");
7
			log.info("created the topic connection successfully");
8
		} catch (JMSException e) {
8
		} catch (JMSException e) {
9
			log.error("Connection error: " + e.getMessage());
9
			log.error("Connection error: " + e.getMessage());
10
		}
10
		}
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 comparisons49
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    2
    ConnectionFactory.getTopicConnectionFactory(ctx, connfactory);
    2
    ConnectionFactory.getTopicConnectionFactory(ctx, connfactory);
    3
    this.CONN = ConnectionFactory.getTopicConnection();
    3
    this.CONN = ConnectionFactory.getTopicConnection();
    4
    this.TOPIC = InitialContextFactory.lookupTopic(ctx, topic);
    4
    this.TOPIC = InitialContextFactory.lookupTopic(ctx, topic);
    5
    this.SESSION = this.CONN.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
    5
    this.SESSION = this.CONN.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
                                                                                                                              
    6
    this.SUBSCRIBER = this.SESSION.createSubscriber(this.TOPIC);
    Preondition Violations
    Unmatched statement this.SUBSCRIBER=this.SESSION.createSubscriber(this.TOPIC); 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
    6
    this.SUBSCRIBER = this.SESSION.createSubscriber(this.TOPIC);
    6
    this.PUBLISHER = this.SESSION.createPublisher(this.TOPIC);
    6
    this.PUBLISHER = this.SESSION.createPublisher(this.TOPIC);
    Preondition Violations
    Unmatched statement this.PUBLISHER=this.SESSION.createPublisher(this.TOPIC); 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
                                                                                                                          
    7
    log.info("created the topic connection successfully");
    7
    log.info("created the topic connection successfully");
    Precondition Violations (2)
    Row Violation
    1Unmatched statement this.SUBSCRIBER=this.SESSION.createSubscriber(this.TOPIC); 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 statement this.PUBLISHER=this.SESSION.createPublisher(this.TOPIC); 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