if (destinationFile != null) { for (Iterator i = rc.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof FileResource) { File f = ((FileResource) o).getFile(); if (FILE_UTILS.fileNameEquals(f, destinationFile)) { throw new BuildException("Input file \"" + f + "\" is the same as the output file."); } } } }
NameEntry ne = (NameEntry) e.nextElement(); String fileName = ne.evalName(p); if (fileName != null) { File inclFile = p.resolveFile(fileName); if (!inclFile.exists()) { throw new BuildException("Includesfile " + inclFile.getAbsolutePath() + " not found."); } readPatterns(inclFile, includeList, p); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Concat.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/PatternSet.java
Method name: ResourceCollection validate() Method name: void readFiles(Project)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (destinationFile != null) {
1
NameEntry ne = 
2
                for (Iterator i = rc.iterator(); i.hasNext();) {
2
(NameEntry) e.nextElement();
3
                    Object o = i.next();
3
                String fileName = ne.evalName(p);
4
                    if (o instanceof FileResource) {
4
                if (
5
                        File f = ((FileResource) o).getFile();
6
                        if (FILE_UTILS.fileNameEquals(f, destinationFile
5
fileName != null) {
6
                    File inclFile = p.resolveFile(fileName);
7
)) {
7
                    if (!inclFile.exists()) {
8
                            throw new BuildException("Input file \""
8
                        throw new BuildException("Includesfile "
9
                                + f + "\" is the same as the output file.");
9
                                
10
                        }
11
                    }
12
                }
10
                 + inclFile.getAbsolutePath()
11
                                                 + " not found.");
12
                    }
13
                    readPatterns(inclFile, includeList, p);
13
            }
14
                }
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 having the same super class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                      
    7
    File inclFile = p.resolveFile(fileName);
    Preondition Violations
    Unmatched statement File inclFile=p.resolveFile(fileName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    File inclFile = p.resolveFile(fileName);
    31
    File f = ((FileResource)o).getFile();
    31
    File f = ((FileResource)o).getFile();
    Preondition Violations
    Unmatched statement File f=((FileResource)o).getFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    32
    if (FILE_UTILS.fileNameEquals(f, destinationFile))
    32
    if (FILE_UTILS.fileNameEquals(f, destinationFile))
    8
    if (!inclFile.exists())
    Differences
    Expression1Expression2Difference
    FILE_UTILS.fileNameEquals(f,destinationFile)!inclFile.exists()TYPE_COMPATIBLE_REPLACEMENT
    8
    if (!inclFile.exists())
                                                                                                                                                                                        
    9
    throw new BuildException("Includesfile " + inclFile.getAbsolutePath() + " not found.");
    Preondition Violations
    Unmatched throw new BuildException("Includesfile " + inclFile.getAbsolutePath() + " not found.");
    9
    throw new BuildException("Includesfile " + inclFile.getAbsolutePath() + " not found.");
    33
    throw new BuildException("Input file \"" + f + "\" is the same as the output file.");
    33
    throw new BuildException("Input file \"" + f + "\" is the same as the output file.");
    Preondition Violations
    Unmatched throw new BuildException("Input file \"" + f + "\" is the same as the output file.");
                                                                                                                                                                                      
    Precondition Violations (4)
    Row Violation
    1Unmatched statement File inclFile=p.resolveFile(fileName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement File f=((FileResource)o).getFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched throw new BuildException("Includesfile " + inclFile.getAbsolutePath() + " not found.");
    4Unmatched throw new BuildException("Input file \"" + f + "\" is the same as the output file.");