/** * */ private void initConfiguration() { XmlElement gui = MailConfig.getInstance().get("options").getElement( "/options/gui"); XmlElement messageviewer = gui.getElement("messageviewer"); if (messageviewer == null) { messageviewer = gui.addSubElement("messageviewer"); } messageviewer.addObserver(this); 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; } XmlElement quote = messageviewer.getElement("quote"); if (quote == null) { quote = messageviewer.addSubElement("quote"); } // register as configuration change listener quote.addObserver(this); // register for configuration changes Font font = FontProperties.getTextFont(); name = font.getName(); XmlElement options = Config.getInstance().get("options").getElement( "/options"); XmlElement gui1 = options.getElement("gui"); XmlElement fonts = gui1.getElement("fonts"); if (fonts == null) { fonts = gui1.addSubElement("fonts"); } // register interest on configuratin changes fonts.addObserver(this); // XmlElement selectedBrowser = // messageviewer.getElement(OptionsItem.SELECTED_BROWSER); // selectedBrowser.addObserver(this); }
/** * */ private void getConfigurationValues() { XmlElement markasread = MailConfig.getInstance().get("options").getElement("/options/markasread"); // listen for configuration changes markasread.addObserver(this); // get interval value String delayString = markasread.getAttribute("delay", "2"); delay = Integer.parseInt(delayString); // enable timer String enabledString = markasread.getAttribute("enabled", "true"); enabled = enabledString.equals("true") ? true : false; }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/viewer/TextViewer.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/viewer/MarkAsReadTimer.java
Method name: void initConfiguration() Method name: void getConfigurationValues()
Number of AST nodes: 3 Number of AST nodes: 1
1
/**
1
/**
2
	 *
2
	 * 
3
	 */
3
	 */
4
	private void initConfiguration() {
4
	private void getConfigurationValues() {
5
		XmlElement gui = MailConfig.getInstance().get("options").getElement(
5
		XmlElement markasread = MailConfig.getInstance().get("options").getElement("/options/markasread");
6
				"/options/gui");
6
7
		XmlElement messageviewer = gui.getElement("messageviewer");
7
        // listen for configuration changes
8
8
        markasread.addObserver(this);
9
		if (messageviewer == null) {
9
10
			messageviewer = gui.addSubElement("messageviewer");
10
        // get interval value
11
		}
11
        String delayString = markasread.getAttribute("delay", "2");
12
12
        delay = Integer.parseInt(delayString);
13
		messageviewer.addObserver(this);
13
14
14
        // enable timer
15
		smilies = messageviewer.getElement("smilies");
15
        String enabledString = markasread.getAttribute("enabled", "true");
16
16
        enabled = enabledString.equals("true") ? true : false;
17
		if (smilies == null) {
17
	}
18
			smilies = messageviewer.addSubElement("smilies");
19
		}
20
21
		// register as configuration change listener
22
		smilies.addObserver(this);
23
24
		String enable = smilies.getAttribute("enabled", "true");
25
26
		if (enable.equals("true")) {
27
			enableSmilies = true;
28
		} else {
29
			enableSmilies = false;
30
		}
31
32
		XmlElement quote = messageviewer.getElement("quote");
33
34
		if (quote == null) {
35
			quote = messageviewer.addSubElement("quote");
36
		}
37
38
		// register as configuration change listener
39
		quote.addObserver(this);
40
41
		// register for configuration changes
42
		Font font = FontProperties.getTextFont();
43
		name = font.getName();
44
45
		XmlElement options = Config.getInstance().get("options").getElement(
46
				"/options");
47
		XmlElement gui1 = options.getElement("gui");
48
		XmlElement fonts = gui1.getElement("fonts");
49
50
		if (fonts == null) {
51
			fonts = gui1.addSubElement("fonts");
52
		}
53
54
		// register interest on configuratin changes
55
		fonts.addObserver(this);
56
57
		// XmlElement selectedBrowser =
58
		// messageviewer.getElement(OptionsItem.SELECTED_BROWSER);
59
		// selectedBrowser.addObserver(this);
60
61
	}
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score1.000
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    if (enable.equals("true"))
    11
    if (enable.equals("true"))
    6
    enabled = enabledString.equals("true") ? true : false;
    Differences
    Expression1Expression2Difference
    enableenabledStringVARIABLE_NAME_MISMATCH
    enableSmiliesenabledVARIABLE_NAME_MISMATCH
    enableSmiliesenabledVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    Expression enabled is a field being modified, and thus it cannot be parameterized
    Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    Expression enabled is a field being modified, and thus it cannot be parameterized
    6
    enabled = enabledString.equals("true") ? true : false;
    12
    enableSmilies = true;
    12
    enableSmilies = true;
    Differences
    Expression1Expression2Difference
    enableSmiliesenabledVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    Expression enabled is a field being modified, and thus it cannot be parameterized
                                                  
    else
            
    13
    enableSmilies = false;
    13
    enableSmilies = false;
    Differences
    Expression1Expression2Difference
    enableSmiliesenabledVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    Expression enabled is a field being modified, and thus it cannot be parameterized
                                                    
    Precondition Violations (8)
    Row Violation
    1Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    2Expression enabled is a field being modified, and thus it cannot be parameterized
    3Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    4Expression enabled is a field being modified, and thus it cannot be parameterized
    5Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    6Expression enabled is a field being modified, and thus it cannot be parameterized
    7Expression enableSmilies is a field being modified, and thus it cannot be parameterized
    8Expression enabled is a field being modified, and thus it cannot be parameterized