subject = composerOptions.getElement("subject"); if (subject == null) { subject = composerOptions.addSubElement("subject"); } subject.addObserver(this); String askSubject = subject.getAttribute("ask_if_empty", "true"); if (askSubject.equals("true")) { ask = true; } else { ask = false; }
smilies = messageviewer.getElement("smilies"); if (smilies == null) { smilies = messageviewer.addSubElement("smilies"); } // register as configuration change listener smilies.addObserver(this); String enable = smilies.getAttribute("enabled", "true"); if (enable.equals("true")) { enableSmilies = true; } else { enableSmilies = false; }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/composer/SubjectController.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/viewer/TextViewer.java
Method name: void SubjectController(ComposerController) Method name: void initConfiguration()
Number of AST nodes: 8 Number of AST nodes: 8
1
subject = composerOptions.getElement("subject");
1
s
2
        if (subject == null) {
3
            subject = composerOptions.addSubElement("subject");
4
        }
5
        subject
2
milies = messageviewer.getElement("smilies");
3
		if (smilies == null) {
4
			smilies = messageviewer.addSubElement("smilies");
5
		}
6
		// register as configuration change listener
6
.addObserver(this);
7
		smilies.addObserver(this);
7
        String askSubject = subject.getAttribute("ask_if_empty", "true");
8
		String enable = smilies.getAttribute("enabled", "true");
8
        if (askSubject.equals("true")) {
9
		if (enable.equals("true")) {
9
            ask = true;
10
			enableSmilies = true;
10
        } else {
11
		} else {
11
            ask = false;
12
			enableSmilies = false;
12
        }
13
		}
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.4
Clones locationClones are in different classes
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    subject = composerOptions.getElement("subject");
    4
    subject = composerOptions.getElement("subject");
    6
    smilies = messageviewer.getElement("smilies");
    Differences
    Expression1Expression2Difference
    subjectsmiliesVARIABLE_NAME_MISMATCH
    "subject""smilies"LITERAL_VALUE_MISMATCH
    composerOptionsmessageviewerVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression subject is a field being modified, and thus it cannot be parameterized
    Expression smilies is a field being modified, and thus it cannot be parameterized
    6
    smilies = messageviewer.getElement("smilies");
    5
    if (subject == null)
    5
    if (subject == null)
    7
    if (smilies == null)
    Differences
    Expression1Expression2Difference
    subjectsmiliesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression subject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression smilies cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    if (smilies == null)
    6
    subject = composerOptions.addSubElement("subject");
    6
    subject = composerOptions.addSubElement("subject");
    8
    smilies = messageviewer.addSubElement("smilies");
    Differences
    Expression1Expression2Difference
    subjectsmiliesVARIABLE_NAME_MISMATCH
    "subject""smilies"LITERAL_VALUE_MISMATCH
    composerOptionsmessageviewerVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression subject is a field being modified, and thus it cannot be parameterized
    Expression smilies is a field being modified, and thus it cannot be parameterized
    8
    smilies = messageviewer.addSubElement("smilies");
    7
    subject.addObserver(this);
    7
    subject.addObserver(this);
    9
    smilies.addObserver(this);
    Differences
    Expression1Expression2Difference
    subjectsmiliesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression subject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression smilies cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    smilies.addObserver(this);
    8
    String askSubject = subject.getAttribute("ask_if_empty", "true");
    8
    String askSubject = subject.getAttribute("ask_if_empty", "true");
    10
    String enable = smilies.getAttribute("enabled", "true");
    Differences
    Expression1Expression2Difference
    askSubjectenableVARIABLE_NAME_MISMATCH
    "ask_if_empty""enabled"LITERAL_VALUE_MISMATCH
    subjectsmiliesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression subject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression smilies cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    String enable = smilies.getAttribute("enabled", "true");
    9
    if (askSubject.equals("true"))
    9
    if (askSubject.equals("true"))
    11
    if (enable.equals("true"))
    Differences
    Expression1Expression2Difference
    askSubjectenableVARIABLE_NAME_MISMATCH
    11
    if (enable.equals("true"))
    10
    ask = true;
    10
    ask = true;
    12
    enableSmilies = true;
    Differences
    Expression1Expression2Difference
    askenableSmiliesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression ask is a field being modified, and thus it cannot be parameterized
    Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    12
    enableSmilies = true;
    else
    else
    11
    ask = false;
    11
    ask = false;
    13
    enableSmilies = false;
    Differences
    Expression1Expression2Difference
    askenableSmiliesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression ask is a field being modified, and thus it cannot be parameterized
    Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    13
    enableSmilies = false;
    Precondition Violations (14)
    Row Violation
    1Expression subject is a field being modified, and thus it cannot be parameterized
    2Expression smilies is a field being modified, and thus it cannot be parameterized
    3Expression subject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression smilies cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression subject is a field being modified, and thus it cannot be parameterized
    6Expression smilies is a field being modified, and thus it cannot be parameterized
    7Expression subject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression smilies cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression subject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression smilies cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression ask is a field being modified, and thus it cannot be parameterized
    12Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    13Expression ask is a field being modified, and thus it cannot be parameterized
    14Expression enableSmilies is a field being modified, and thus it cannot be parameterized