if (pgp == null) { pgp = new SecurityItem(getRoot().getElement("pgp")); } if (pgp.getBoolean("use_default_account")) { // return default-account ImapItem instead SecurityItem item = MailConfig.getInstance().getAccountList() .getDefaultAccount().getPGPItem(); return item; } return pgp;
if (imap == null) { imap = new ImapItem(getRoot().getElement("imapserver")); } if (imap.getBoolean("use_default_account")) { // return default-account ImapItem instead ImapItem item = MailConfig.getInstance().getAccountList() .getDefaultAccount() .getImapItem(); return item; } return imap;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/config/AccountItem.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/config/AccountItem.java
Method name: SecurityItem getPGPItem() Method name: ImapItem getImapItem()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (pgp == null) {
1
if (imap == null) {
2
            pgp = new SecurityItem(getRoot().getElement("pgp"));
2
            imap = new ImapItem(getRoot().getElement("imapserver"));
3
        }
3
        }
4
        if (pgp.getBoolean("use_default_account")) {
4
        if (imap.getBoolean("use_default_account")) {
5
            // return default-account ImapItem instead 
5
            // return default-account ImapItem instead 
6
            SecurityItem item = MailConfig.getInstance().getAccountList()
6
            ImapItem item = MailConfig.getInstance().getAccountList()
7
                                               .getDefaultAccount().getPGP
7
                                                .getDefaultAccount()
8
Item();
8
                                                .getImapItem();
9
            return item;
9
            return item;
10
        }
10
        }
11
        return pgp;
11
        return imap;
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 declared in the same class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (pgp == null)
    1
    if (pgp == null)
    1
    if (imap == null)
    Differences
    Expression1Expression2Difference
    pgpimapVARIABLE_NAME_MISMATCH
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    1
    if (imap == null)
    2
    pgp = new SecurityItem(getRoot().getElement("pgp"));
    2
    pgp = new SecurityItem(getRoot().getElement("pgp"));
    2
    imap = new ImapItem(getRoot().getElement("imapserver"));
    Differences
    Expression1Expression2Difference
    pgpimapVARIABLE_NAME_MISMATCH
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    "pgp""imapserver"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression pgp is a field being modified, and thus it cannot be parameterized
    Expression imap is a field being modified, and thus it cannot be parameterized
    2
    imap = new ImapItem(getRoot().getElement("imapserver"));
    3
    if (pgp.getBoolean("use_default_account"))
    3
    if (pgp.getBoolean("use_default_account"))
    3
    if (imap.getBoolean("use_default_account"))
    Differences
    Expression1Expression2Difference
    pgpimapVARIABLE_NAME_MISMATCH
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression pgp cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression imap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (imap.getBoolean("use_default_account"))
    4
    SecurityItem item = MailConfig.getInstance().getAccountList().getDefaultAccount().getPGPItem();
    4
    SecurityItem item = MailConfig.getInstance().getAccountList().getDefaultAccount().getPGPItem();
    4
    ImapItem item = MailConfig.getInstance().getAccountList().getDefaultAccount().getImapItem();
    Differences
    Expression1Expression2Difference
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    getPGPItemgetImapItemMETHOD_INVOCATION_NAME_MISMATCH
    4
    ImapItem item = MailConfig.getInstance().getAccountList().getDefaultAccount().getImapItem();
    5
    return item;
    5
    return item;
    5
    return item;
    Differences
    Expression1Expression2Difference
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    5
    return item;
    6
    return pgp;
    6
    return pgp;
    6
    return imap;
    Differences
    Expression1Expression2Difference
    pgpimapVARIABLE_NAME_MISMATCH
    org.columba.mail.config.SecurityItemorg.columba.mail.config.ImapItemSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression pgp cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression imap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    return imap;
    Precondition Violations (6)
    Row Violation
    1Expression pgp is a field being modified, and thus it cannot be parameterized
    2Expression imap is a field being modified, and thus it cannot be parameterized
    3Expression pgp cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression imap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression pgp cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression imap cannot be parameterized, because it has dependencies to/from statements that will be extracted