Element child = getParentElement().getChild(key); if (child == null) { child = new Element(key); getParentElement().addContent(child); } return child.getTextNormalize();
File signature = identity.getSignature(); if( signature == null) { //Create the file signature = new File(System.getProperty("user.home"),".signature"); } ColumbaDesktop.getInstance().openAndWait(signature); // update signature -> will notify all listeners that signature changed identity.setSignature(signature);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/parser/XCSDocumentParser.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/account/EditSignatureAction.java
Method name: String get(String) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 5 Number of AST nodes: 5
1
Element child = getParentElement().getChild(key);
2
		if (child == null) {
3
			child = new Element(key);
4
			getParentElement().addContent(child
1
File signature = identity.getSignature();
2
		if( signature == null) {
3
			//Create the file
4
			signature = new File(System.getProperty("user.home"),".signature");
5
		}
6
		
5
);
7
		ColumbaDesktop.getInstance().openAndWait(signature);
6
		}
8
		
7
		return child.getTextNormalize(
9
		// update signature -> will notify all listeners that signature changed
8
);
10
		identity.setSignature(signature);
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 in different classes
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                        
    1
    File signature = identity.getSignature();
    1
    Element child = getParentElement().getChild(key);
                                                                                                        
    2
    if (child == null)
    2
    if (child == null)
    2
    if (signature == null)
    Differences
    Expression1Expression2Difference
    childsignatureVARIABLE_NAME_MISMATCH
    org.jdom.Elementjava.io.FileVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jdom.Element of variable child does not match with type java.io.File of variable signature
    • Make classes org.jdom.Element and java.io.File extend a common superclass
    2
    if (signature == null)
                                                                                                                                            
    3
    signature = new File(System.getProperty("user.home"), ".signature");
    Preondition Violations
    Unmatched statement signature=new File(System.getProperty("user.home"),".signature"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    signature = new File(System.getProperty("user.home"), ".signature");
    3
    child = new Element(key);
    3
    child = new Element(key);
    Preondition Violations
    Unmatched statement child=new Element(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
    4
    getParentElement().addContent(child);
    4
    getParentElement().addContent(child);
    Preondition Violations
    Unmatched statement getParentElement().addContent(child); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                    
                                                                                                                  
    4
    ColumbaDesktop.getInstance().openAndWait(signature);
                                                                            
    5
    identity.setSignature(signature);
    Preondition Violations
    Unmatched statement identity.setSignature(signature); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    identity.setSignature(signature);
    5
    return child.getTextNormalize();
    5
    return child.getTextNormalize();
    Preondition Violations
    Unmatched return child.getTextNormalize();
                                                                          
    Precondition Violations (7)
    Row Violation
    1Type org.jdom.Element of variable child does not match with type java.io.File of variable signature
    2Unmatched statement signature=new File(System.getProperty("user.home"),".signature"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement child=new Element(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement getParentElement().addContent(child); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement identity.setSignature(signature); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return child.getTextNormalize();
    7The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero