File thisLink = (File) litr.next(); File parent = thisLink.getParentFile(); Vector v = (Vector) byDir.get(parent); if (v == null) { v = new Vector(); byDir.put(parent, v); } v.addElement(thisLink);
List list = (List) prefixMapping.get(prefix); if (list == null) { list = new ArrayList(); prefixMapping.put(prefix, list); } list.add(uri);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/helper/AntXMLContext.java
Method name: void record() Method name: void startPrefixMapping(String, String)
Number of AST nodes: 7 Number of AST nodes: 5
1
File thisLink = (File) litr.next();
2
                File parent = thisLink.getParentFile();
1
List list = (List) pre
3
                Vector v = (Vector) byDir.get(parent);
2
fixMapping.get(pre
4
     
3
fix);
5
           if (v == null) {
4
        if (list == null) {
6
                    v = new Vector();
5
            list = new ArrayList();
7
                    byDir.put(parent, v);
6
            prefixMapping.put(pre
8
       
7
fix, list);
9
         }
8
        }
10
                v.addElement(thisLink);
9
        list.add(uri);
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 comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                              
    1
    List list = (List)prefixMapping.get(prefix);
                                      
    5
    list.add(uri);
    10
    File thisLink = (File)litr.next();
                                                                            
    11
    File parent = thisLink.getParentFile();
    11
    File parent = thisLink.getParentFile();
    Preondition Violations
    Unmatched statement File parent=thisLink.getParentFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    12
    Vector v = (Vector)byDir.get(parent);
    12
    Vector v = (Vector)byDir.get(parent);
    Preondition Violations
    Unmatched statement Vector v=(Vector)byDir.get(parent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    13
    if (v == null)
    13
    if (v == null)
    2
    if (list == null)
    Differences
    Expression1Expression2Difference
    vlistVARIABLE_NAME_MISMATCH
    java.util.Vectorjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Vector of variable v does not match with type java.util.List of variable list
    • Make classes java.util.Vector and java.util.List extend a common superclass
    2
    if (list == null)
                                                    
    3
    list = new ArrayList();
    Preondition Violations
    Unmatched statement list=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    list = new ArrayList();
    14
    v = new Vector();
    14
    v = new Vector();
    Preondition Violations
    Unmatched statement v=new Vector(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    15
    byDir.put(parent, v);
    15
    byDir.put(parent, v);
    4
    prefixMapping.put(prefix, list);
    Differences
    Expression1Expression2Difference
    parentprefixVARIABLE_NAME_MISMATCH
    java.io.Filejava.lang.StringVARIABLE_TYPE_MISMATCH
    byDirprefixMappingVARIABLE_NAME_MISMATCH
    java.util.Hashtablejava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.File of variable parent does not match with type java.lang.String of variable prefix
    • Make classes java.io.File and java.lang.String extend a common superclass
    Type java.util.Hashtable of variable byDir does not match with type java.util.Map of variable prefixMapping
    • Make classes java.util.Hashtable and java.util.Map extend a common superclass
    4
    prefixMapping.put(prefix, list);
    16
    v.addElement(thisLink);
                                                          
    Precondition Violations (7)
    Row Violation
    1Unmatched statement File parent=thisLink.getParentFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Vector v=(Vector)byDir.get(parent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type java.util.Vector of variable v does not match with type java.util.List of variable list
    4Unmatched statement list=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement v=new Vector(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type java.io.File of variable parent does not match with type java.lang.String of variable prefix
    7Type java.util.Hashtable of variable byDir does not match with type java.util.Map of variable prefixMapping