if (isIncluded(currentelement) && currentelement.length() > 0) { accountForIncludedDir(currentelement, myfile, true); } else { if (currentelement.length() > 0) { if (currentelement.charAt(currentelement .length() - 1) != File.separatorChar) { currentelement = currentelement + File.separatorChar; } } scandir(myfile, currentelement, true); }
if (isIncluded(currentelement) && currentelement.length() > 0) { accountForIncludedDir(currentelement, myfile, true); } else { if (currentelement.length() > 0) { if (currentelement.charAt(currentelement .length() - 1) != File.separatorChar) { currentelement = currentelement + File.separatorChar; } } scandir(myfile.getAbsolutePath(), currentelement, true); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/DirectoryScanner.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Method name: void checkIncludePatterns() Method name: void checkIncludePatterns()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (isIncluded(currentelement)
1
if (isIncluded(currentelement)
2
                            && currentelement.length() > 0) {
2
                                && currentelement.length() > 0) {
3
                            accountForIncludedDir(currentelement, myfile, true);
3
                                accountForIncludedDir(currentelement, myfile, true);
4
                        }  else {
4
                            }  else {
5
                            if (currentelement.length() > 0) {
5
                                if (currentelement.length() > 0) {
6
                                if (currentelement.charAt(currentelement
6
                                    if (currentelement.charAt(currentelement
7
                                                          .length() - 1)
7
                                                              .length() - 1)
8
                                    != File.separatorChar) {
8
                                        != File.separatorChar) {
9
                                    currentelement =
9
                                        currentelement =
10
                                        currentelement + File.separatorChar;
10
                                            currentelement + File.separatorChar;
11
                                }
11
                                
12
    }
12
                            }
13
                                }
13
                            scandir(myfile, currentelement, true);
14
                                scandir(myfile.getAbsolutePath(), currentelement, true);
14
                        }
15
                            }
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 comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)30.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    39
    if (isIncluded(currentelement) && currentelement.length() > 0)
    33
    if (isIncluded(currentelement) && currentelement.length() > 0)
    40
    accountForIncludedDir(currentelement, myfile, true);
    40
    accountForIncludedDir(currentelement, myfile, true);
    34
    accountForIncludedDir(currentelement, myfile, true);
    Differences
    Expression1Expression2Difference
    java.io.Fileorg.apache.tools.ant.taskdefs.optional.net.FTP.FTPDirectoryScanner.AntFTPFileVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.File of variable myfile does not match with type org.apache.tools.ant.taskdefs.optional.net.FTP.FTPDirectoryScanner.AntFTPFile of variable myfile
    • Make classes java.io.File and org.apache.tools.ant.taskdefs.optional.net.FTP.FTPDirectoryScanner.AntFTPFile extend a common superclass
    34
    accountForIncludedDir(currentelement, myfile, true);
    else
    else
    41
    if (currentelement.length() > 0)
    35
    if (currentelement.length() > 0)
    42
    if (currentelement.charAt(currentelement.length() - 1) != File.separatorChar)
    36
    if (currentelement.charAt(currentelement.length() - 1) != File.separatorChar)
    43
    currentelement = currentelement + File.separatorChar;
    37
    currentelement = currentelement + File.separatorChar;
                                                                                                                        
    38
    scandir(myfile.getAbsolutePath(), currentelement, true);
    Preondition Violations
    Unmatched statement scandir(myfile.getAbsolutePath(),currentelement,true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    38
    scandir(myfile.getAbsolutePath(), currentelement, true);
    44
    scandir(myfile, currentelement, true);
    44
    scandir(myfile, currentelement, true);
    Preondition Violations
    Unmatched statement scandir(myfile,currentelement,true); 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
    1Type java.io.File of variable myfile does not match with type org.apache.tools.ant.taskdefs.optional.net.FTP.FTPDirectoryScanner.AntFTPFile of variable myfile
    2Unmatched statement scandir(myfile.getAbsolutePath(),currentelement,true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement scandir(myfile,currentelement,true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted