log("Copying " + filecopyList.size() + " file" + (filecopyList.size() == 1 ? "" : "s") + " to " + destDir.getAbsolutePath()); Enumeration e = filecopyList.keys(); while (e.hasMoreElements()) { String fromFile = (String) e.nextElement(); String toFile = (String) filecopyList.get(fromFile); try { getProject().copyFile(fromFile, toFile, filtering, forceOverwrite); } catch (IOException ioe) { String msg = "Failed to copy " + fromFile + " to " + toFile + " due to " + ioe.getMessage(); throw new BuildException(msg, ioe, getLocation()); } }
if (filecopyList.size() > 0) { log("Copying " + filecopyList.size() + " file" + (filecopyList.size() == 1 ? "" : "s") + " to " + destDir.getAbsolutePath()); Enumeration e = filecopyList.keys(); while (e.hasMoreElements()) { String fromFile = (String) e.nextElement(); String toFile = (String) filecopyList.get(fromFile); try { FileUtils.getFileUtils().copyFile(fromFile, toFile); } catch (IOException ioe) { String msg = "Failed to copy " + fromFile + " to " + toFile + " due to " + ioe.getMessage(); throw new BuildException(msg, ioe); } } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Copydir.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
Method name: void execute() Method name: void copyFilesToDestination()
Number of AST nodes: 7 Number of AST nodes: 8
1
if (filecopyList.size() > 0) {
1
log("Copying " + filecopyList.size() + " file"
2
            log("Copying " + filecopyList.size() + " file"
2
                    + (filecopyList.size() == 1 ? "" : "s")
3
                 + (filecopyList.size() == 1 ? "" : "s")
3
                    + " to " + destDir.getAbsolutePath());
4
                 + " to " + destDir.getAbsolutePath());
4
   
5
             Enumeration e = filecopyList.keys();
5
            Enumeration e = filecopyList.keys();
6
  
7
              while (e.hasMoreElements()) {
6
            while (e.hasMoreElements()) {
8
                    String fromFile = (String) e.nextElement();
7
                String fromFile = (String) e.nextElement();
9
                    String toFile = (String) filecopyList.get(fromFile);
8
                String toFile = (String) filecopyList.get(fromFile);
10
    
11
                try {
9
                try {
12
                        getProject().copyFile(fromFile, toFile, filtering,
10
                    FileUtils.getFileUtils().copyFile(fromFile, toFile
13
                                         forceOverwrite);
14
    
11
);
15
                } catch (IOException ioe) {
12
                } catch (IOException ioe) {
16
                        String msg = "Failed to copy " + fromFile + " to "
13
                    String msg = "Failed to copy " + fromFile + " to "
17
   
14
 + toFile
18
                         + toFile + " due to " + ioe.getMessage();
15
                         + " due to " + ioe.getMessage();
19
    
20
                    throw new BuildException(msg, ioe, getLocation());
16
                    throw new BuildException(msg, ioe
21
    
17
);
22
                }
18
                }
23
        
19
            }
24
        }
20
        }
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.6
Clones locationClones are in different classes having the same super class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    15
    log("Copying " + filecopyList.size() + " file" + (filecopyList.size() == 1 ? "" : "s") + " to " + destDir.getAbsolutePath());
    2
    log("Copying " + filecopyList.size() + " file" + (filecopyList.size() == 1 ? "" : "s") + " to " + destDir.getAbsolutePath());
    16
    Enumeration e = filecopyList.keys();
    3
    Enumeration e = filecopyList.keys();
    17
    while (e.hasMoreElements())
    4
    while (e.hasMoreElements())
    18
    String fromFile = (String)e.nextElement();
    5
    String fromFile = (String)e.nextElement();
    19
    String toFile = (String)filecopyList.get(fromFile);
    6
    String toFile = (String)filecopyList.get(fromFile);
    20
    try
    20
    try
    7
    try
    Differences
    Expression1Expression2Difference
    new BuildException(msg,ioe,getLocation())new BuildException(msg,ioe)ARGUMENT_NUMBER_MISMATCH
    7
    try
                                                                                                                
    8
    FileUtils.getFileUtils().copyFile(fromFile, toFile);
    Preondition Violations
    Unmatched statement FileUtils.getFileUtils().copyFile(fromFile,toFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    FileUtils.getFileUtils().copyFile(fromFile, toFile);
    21
    getProject().copyFile(fromFile, toFile, filtering, forceOverwrite);
    21
    getProject().copyFile(fromFile, toFile, filtering, forceOverwrite);
    Preondition Violations
    Unmatched statement getProject().copyFile(fromFile,toFile,filtering,forceOverwrite); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                            
    Precondition Violations (3)
    Row Violation
    1Unmatched statement FileUtils.getFileUtils().copyFile(fromFile,toFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement getProject().copyFile(fromFile,toFile,filtering,forceOverwrite); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables fromFile, toFile , while Clone fragment #2 returns variables fromFile, toFile