String[] destfiles = map.mapFileName(filename); // If filename does not match the To attribute of the mapper // then filter it out of the files we are considering if (destfiles == null) { return false; } // Sanity check if (destfiles.length != 1 || destfiles[0] == null) { throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename " + filename); } String destname = destfiles[0]; File destfile = new File(targetdir, destname);
String[] destfiles = map.mapFileName(filename); // If filename does not match the To attribute of the mapper // then filter it out of the files we are considering if (destfiles == null) { return false; } // Sanity check if (destfiles.length != 1 || destfiles[0] == null) { throw new BuildException("Invalid destination file results for " + targetdir + " with filename " + filename); } String destname = destfiles[0]; File destfile = new File(targetdir, destname);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/MappingSelector.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/PresentSelector.java
Method name: boolean isSelected(File, String, File) Method name: boolean isSelected(File, String, File)
Number of AST nodes: 7 Number of AST nodes: 7
1
String[] destfiles = map.mapFileName(filename);
1
String[] destfiles = map.mapFileName(filename);
2
        // If filename does not match the To attribute of the mapper
2
        // If filename does not match the To attribute of the mapper
3
        // then filter it out of the files we are considering
3
        // then filter it out of the files we are considering
4
        if (destfiles == null) {
4
        if (destfiles == null) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        // Sanity check
7
        // Sanity check
8
        if (destfiles.length != 1 || destfiles[0] == null) {
8
        if (destfiles.length != 1 || destfiles[0] == null) {
9
            throw new BuildException("Invalid destination file results for "
9
            throw new BuildException("Invalid destination file results for "
10
                    + targetdir.getName() + " with filename " + filename);
10
                    + targetdir + " with filename " + filename);
11
        }
11
        }
12
        String destname = destfiles[0];
12
        String destname = destfiles[0];
13
        File destfile = new File(targetdir, destname);
13
        File destfile = new File(targetdir, destname);
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons15
  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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    String[] destfiles = map.mapFileName(filename);
    2
    String[] destfiles = map.mapFileName(filename);
    3
    if (destfiles == null)
    3
    if (destfiles == null)
    4
    return false;
    4
    return false;
    5
    if (destfiles.length != 1 || destfiles[0] == null)
    5
    if (destfiles.length != 1 || destfiles[0] == null)
                                                                                                                                                                                                                                  
    6
    throw new BuildException("Invalid destination file results for " + targetdir + " with filename " + filename);
    Preondition Violations
    Unmatched statement throw new BuildException("Invalid destination file results for " + targetdir + " with filename "+ filename); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched throw new BuildException("Invalid destination file results for " + targetdir + " with filename "+ filename);
    6
    throw new BuildException("Invalid destination file results for " + targetdir + " with filename " + filename);
    6
    throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename " + filename);
    6
    throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename " + filename);
    Preondition Violations
    Unmatched statement throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename "+ filename); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    Unmatched throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename "+ filename);
                                                                                                                                                                                                                                                      
    7
    String destname = destfiles[0];
    7
    String destname = destfiles[0];
    8
    File destfile = new File(targetdir, destname);
    8
    File destfile = new File(targetdir, destname);
    Precondition Violations (5)
    Row Violation
    1Unmatched statement throw new BuildException("Invalid destination file results for " + targetdir + " with filename "+ filename); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched throw new BuildException("Invalid destination file results for " + targetdir + " with filename "+ filename);
    3Unmatched statement throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename "+ filename); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4Unmatched throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename "+ filename);
    5Not all possible execution flows end in a return statement