String loginMethod = item.get("login_method"); int result = 0; try { result = Integer.parseInt(loginMethod); } catch (NumberFormatException e) { // Just use the default as fallback } if (result == 0) { List supported = checkSupportedAuthenticationMethods(); if (usingSSL) { // NOTE if SSL is possible we just need the plain login // since SSL does the encryption for us. result = ((Integer) supported.get(0)).intValue(); } else { Collections.sort(supported, new AuthenticationSecurityComparator()); result = ((Integer) supported.get(supported.size() - 1)) .intValue(); } } return result;
String loginMethod = popItem.get("login_method"); int result = 0; try { result = Integer.parseInt(loginMethod); } catch (NumberFormatException e) { // Just use the default as fallback } if (result == 0) { List supported = checkSupportedAuthenticationMethods(); if (usingSSL) { // NOTE if SSL is possible we just need the plain login // since SSL does the encryption for us. result = ((Integer) supported.get(0)).intValue(); } else { Collections.sort(supported, new AuthenticationSecurityComparator()); result = ((Integer) supported.get(supported.size() - 1)) .intValue(); } } return result;
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/mail/src/main/java/org/columba/mail/pop3/POP3Store.java
Method name: int getLoginMethod() Method name: int getLoginMethod()
Number of AST nodes: 11 Number of AST nodes: 11
1
String loginMethod = item.get("login_method");
1
String loginMethod = popItem.get("login_method");
2
		int result = 0;
2
		int result = 0;
3
		try {
3
		try {
4
			result = Integer.parseInt(loginMethod);
4
			result = Integer.parseInt(loginMethod);
5
		} catch (NumberFormatException e) {
5
		} catch (NumberFormatException e) {
6
			// Just use the default as fallback
6
			// Just use the default as fallback
7
		}
7
		}
8
		if (result == 0) {
8
		if (result == 0) {
9
			List supported = checkSupportedAuthenticationMethods();
9
			List supported = checkSupportedAuthenticationMethods();
10
			if (usingSSL) {
10
			if (usingSSL) {
11
				// NOTE if SSL is possible we just need the plain login
11
				// NOTE if SSL is possible we just need the plain login
12
				// since SSL does the encryption for us.
12
				// since SSL does the encryption for us.
13
				result = ((Integer) supported.get(0)).intValue();
13
				result = ((Integer) supported.get(0)).intValue();
14
			} else {
14
			} else {
15
				Collections.sort(supported,
15
				Collections.sort(supported,
16
						new AuthenticationSecurityComparator());
16
						new AuthenticationSecurityComparator());
17
				result = ((Integer) supported.get(supported.size() - 1))
17
				result = ((Integer) supported.get(supported.size() - 1))
18
						.intValue();
18
						.intValue();
19
			}
19
			}
20
		}
20
		}
21
		return result;
21
		return result;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons33
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String loginMethod = item.get("login_method");
    1
    String loginMethod = item.get("login_method");
    1
    String loginMethod = popItem.get("login_method");
    Differences
    Expression1Expression2Difference
    itempopItemVARIABLE_NAME_MISMATCH
    org.columba.mail.config.ImapItemorg.columba.mail.config.PopItemSUBCLASS_TYPE_MISMATCH
    1
    String loginMethod = popItem.get("login_method");
    2
    int result = 0;
    2
    int result = 0;
    3
    try
    3
    try
    4
    result = Integer.parseInt(loginMethod);
    4
    result = Integer.parseInt(loginMethod);
    5
    if (result == 0)
    5
    if (result == 0)
    6
    List supported = checkSupportedAuthenticationMethods();
    6
    List supported = checkSupportedAuthenticationMethods();
    7
    if (usingSSL)
    7
    if (usingSSL)
    8
    result = ((Integer)supported.get(0)).intValue();
    8
    result = ((Integer)supported.get(0)).intValue();
    else
    else
    9
    Collections.sort(supported, new AuthenticationSecurityComparator());
    9
    Collections.sort(supported, new AuthenticationSecurityComparator());
    10
    result = ((Integer)supported.get(supported.size() - 1)).intValue();
    10
    result = ((Integer)supported.get(supported.size() - 1)).intValue();
    11
    return result;
    11
    return result;
    Precondition Violations (0)
    Row Violation