url = HelpSet.findHelpSet(loader, helpsetName, ".hs", Locale .getDefault()); if (url == null) { // could not find it! JOptionPane.showMessageDialog(FrameManager.getInstance() .getActiveFrame(), "HelpSet not found", "Error", JOptionPane.ERROR_MESSAGE); return; }
if (savemsg == null) { // create new savemsg = new XmlElement("savemsg"); savemsg.addAttribute("incl_all_headers", String.valueOf(val)); options.addElement(savemsg); } else { savemsg.addAttribute("incl_all_headers", String.valueOf(val)); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/help/HelpManager.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/command/SaveMessageBodyAsCommand.java
Method name: void HelpManager() Method name: void storeInclAllHeadersOption(boolean)
Number of AST nodes: 4 Number of AST nodes: 5
1
url = HelpSet.findHelpSet(loader, helpsetName, ".hs", Locale
2
					.getDefault());
3
			if (url == null) {
4
				// could not find it!
5
				JOptionPane.showMessageDialog(FrameManager.getInstance()
6
						.getActiveFrame(), "HelpSet not found",
7
						"Error", JOptionPane.ERROR_MESSAGE);
8
				return;
9
			
1
if (savemsg == null) {
2
            // create new
3
            savemsg = new XmlElement("savemsg");
4
            savemsg.addAttribute("incl_all_headers", String.valueOf(val));
5
            options.addElement(savemsg);
6
        } else {
7
            savemsg.addAttribute("incl_all_headers", String.valueOf(val));
10
}
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.1
Clones locationClones are in different classes
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    url = HelpSet.findHelpSet(loader, helpsetName, ".hs", Locale.getDefault());
                                                                                                                                                      
    5
    if (url == null)
    5
    if (url == null)
    5
    if (savemsg == null)
    Differences
    Expression1Expression2Difference
    urlsavemsgVARIABLE_NAME_MISMATCH
    java.net.URLorg.columba.core.xml.XmlElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.URL of variable url does not match with type org.columba.core.xml.XmlElement of variable savemsg
    • Make classes java.net.URL and org.columba.core.xml.XmlElement extend a common superclass
    5
    if (savemsg == null)
                                                                              
    6
    savemsg = new XmlElement("savemsg");
    Preondition Violations
    Unmatched statement savemsg=new XmlElement("savemsg"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    savemsg = new XmlElement("savemsg");
    6
    JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(), "HelpSet not found", "Error", JOptionPane.ERROR_MESSAGE);
                                                                                                                                                                                                                                                                            
                                                                                                                                    
    7
    savemsg.addAttribute("incl_all_headers", String.valueOf(val));
    7
    return;
    7
    return;
    Preondition Violations
    Unmatched return;
                        
                                                                  
    8
    options.addElement(savemsg);
            
    else
                                                                                                                                    
    9
    savemsg.addAttribute("incl_all_headers", String.valueOf(val));
    Precondition Violations (3)
    Row Violation
    1Type java.net.URL of variable url does not match with type org.columba.core.xml.XmlElement of variable savemsg
    2Unmatched statement savemsg=new XmlElement("savemsg"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return;