if (protocol.getState() != IMAPProtocol.NOT_CONNECTED) { try { protocol.logout(); } catch (Exception e) { // don't care } }
for (int i = 0; i < 10; i++) { try { Thread.sleep(1000); } catch (InterruptedException ie) { } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/imap/IMAPServer.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/shutdown/ShutdownManager.java
Method name: void logout() Method name: void run()
Number of AST nodes: 3 Number of AST nodes: 3
1
if (protocol.getState() != IMAPProtocol.NOT_CONNECTED) {
1
for (int i = 0; i < 10; i++) {
2
			try {
2
							try {
3
				protocol.logout();
3
				
4
				Thread.sleep(1000);
4
			} catch (Exception e) {
5
							} catch (InterruptedException ie) {
5
				// don't care
6
				
6
			}
7
			}
7
		}
8
						}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    8
    try
    Differences
    Expression1Expression2Difference
    java.lang.Exceptionjava.lang.InterruptedExceptionSUBCLASS_TYPE_MISMATCH
    eieVARIABLE_NAME_MISMATCH
    java.lang.Exceptionjava.lang.InterruptedExceptionSUBCLASS_TYPE_MISMATCH
    8
    try
    3
    protocol.logout();
    3
    protocol.logout();
    9
    Thread.sleep(1000);
    Differences
    Expression1Expression2Difference
    logoutsleepMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.ristretto.imap.IMAPProtocoljava.lang.ThreadVARIABLE_TYPE_MISMATCH
    protocol.logout()Thread.sleep(1000)TYPE_COMPATIBLE_REPLACEMENT
    protocol.logout()Thread.sleep(1000)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression protocol.logout() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression Thread.sleep(1000) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression protocol.logout() is a void method call, and thus it cannot be parameterized
    Expression Thread.sleep(1000) is a void method call, and thus it cannot be parameterized
    Type org.columba.ristretto.imap.IMAPProtocol of variable protocol does not match with type java.lang.Thread of variable Thread
    • Make classes org.columba.ristretto.imap.IMAPProtocol and java.lang.Thread extend a common superclass
    Expression protocol.logout() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression Thread.sleep(1000) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression protocol.logout() is a void method call, and thus it cannot be parameterized
    Expression Thread.sleep(1000) is a void method call, and thus it cannot be parameterized
    9
    Thread.sleep(1000);
    Precondition Violations (10)
    Row Violation
    1Expression protocol.logout() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression Thread.sleep(1000) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Expression protocol.logout() is a void method call, and thus it cannot be parameterized
    4Expression Thread.sleep(1000) is a void method call, and thus it cannot be parameterized
    5Type org.columba.ristretto.imap.IMAPProtocol of variable protocol does not match with type java.lang.Thread of variable Thread
    6Expression protocol.logout() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    7Expression Thread.sleep(1000) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8Expression protocol.logout() is a void method call, and thus it cannot be parameterized
    9Expression Thread.sleep(1000) is a void method call, and thus it cannot be parameterized
    10The refactoring of the clones is infeasible, because classes org.columba.mail.imap.IMAPServer and do not have a common superclass