if (element.isDirectory()) { // push the current iterator onto the stack and then // iterate through this directory. enumStack.push(currentEnum); Vector files = getDirectoryEntries(element); currentEnum = files.elements(); } else { // we have a file. create a stream for it FileInputStream inFileStream = new FileInputStream(element); if (element.getName().endsWith(".class")) { // create a data input stream from the jar // input stream ClassFile javaClass = new ClassFile(); javaClass.read(inFileStream); nextElement = javaClass; } }
if (file.canRead()) { checksum.reset(); FileInputStream fis = new FileInputStream(file); CheckedInputStream check = new CheckedInputStream(fis, checksum); BufferedInputStream in = new BufferedInputStream(check); while (in.read() != -1) { // Read the file } rval = Long.toString(check.getChecksum().getValue()); in.close(); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java
Method name: ClassFile getNextClassFile() Method name: String getValue(File)
Number of AST nodes: 9 Number of AST nodes: 8
1
if (element.isDirectory()) {
1
if (file.canRead()) {
2
                        // push the current iterator onto the stack and then
2
                 
3
                        // iterate through this directory.
4
                        enumStack.push(currentEnum);
5
                        Vector
3
checksum.reset();
6
 files = getDirectoryEntries(element);
4
                 FileInputStream fis = 
7
                        currentEnum = files.elements();
8
                    } else {
9
                        // we have a file. create a stream for it
10
       
5
new FileInputStream(file);
6
                 CheckedInputStream check = new CheckedInputStream(fis, checksum);
11
                 FileInputStream inFileStream
7
                 BufferedInputStream in
12
                            = new FileInputStream(element);
8
 = new BufferedInputStream(check);
13
                        if (element.getName().endsWith(".class")) {
9
                 
14
                            // create a data input stream from the jar
15
                            // input stream
16
                            ClassFile javaClass = new ClassFile();
17
                            javaClass.read(inFileStream
10
while (in.read() != -1) {
11
                     // Read the file
12
                 }
18
);
13
                 rval = Long.toString(check.getChecksum().getValue());
19
                            nextElement = javaClass;
14
                 
20
                        }
21
        
15
in.close();
22
            }
16
            }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes
Number of node comparisons1