String name = entry.getName(); if (entry.isDirectory()) { name = trimSeparator(name); dirEntries.put(name, r); if (match(name)) { matchDirEntries.put(name, r); } } else { fileEntries.put(name, r); if (match(name)) { matchFileEntries.put(name, r); } }
String name = entry.getName(); if (entry.isDirectory()) { name = trimSeparator(name); dirEntries.put(name, r); if (match(name)) { matchDirEntries.put(name, r); } } else { fileEntries.put(name, r); if (match(name)) { matchFileEntries.put(name, r); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/TarScanner.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/ZipScanner.java
Method name: void fillMapsFromArchive(Resource, String, Map, Map, Map, Map) Method name: void fillMapsFromArchive(Resource, String, Map, Map, Map, Map)
Number of AST nodes: 9 Number of AST nodes: 9
1
String name = entry.getName();
1
String name = entry.getName();
2
                if (entry.isDirectory()) {
2
                if (entry.isDirectory()) {
3
                    name = trimSeparator(name);
3
                    name = trimSeparator(name);
4
                    dirEntries.put(name, r);
4
                    dirEntries.put(name, r);
5
                    if (match(name)) {
5
                    if (match(name)) {
6
                        matchDirEntries.put(name, r);
6
                        matchDirEntries.put(name, r);
7
                    }
7
                    }
8
                } else {
8
                } else {
9
                    fileEntries.put(name, r);
9
                    fileEntries.put(name, r);
10
                    if (match(name)) {
10
                    if (match(name)) {
11
                        matchFileEntries.put(name, r);
11
                        matchFileEntries.put(name, r);
12
                    }
12
                    }
13
                }
13
                }
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)8.4
Clones locationClones are in different classes having the same super class
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)116.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    String name = entry.getName();
    8
    String name = entry.getName();
    14
    String name = entry.getName();
    Differences
    Expression1Expression2Difference
    org.apache.tools.tar.TarEntryorg.apache.tools.zip.ZipEntryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.tar.TarEntry of variable entry does not match with type org.apache.tools.zip.ZipEntry of variable entry
    • Make classes org.apache.tools.tar.TarEntry and org.apache.tools.zip.ZipEntry extend a common superclass
    14
    String name = entry.getName();
    9
    if (entry.isDirectory())
    9
    if (entry.isDirectory())
    15
    if (entry.isDirectory())
    Differences
    Expression1Expression2Difference
    org.apache.tools.tar.TarEntryorg.apache.tools.zip.ZipEntryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.tar.TarEntry of variable entry does not match with type org.apache.tools.zip.ZipEntry of variable entry
    • Make classes org.apache.tools.tar.TarEntry and org.apache.tools.zip.ZipEntry extend a common superclass
    15
    if (entry.isDirectory())
    10
    name = trimSeparator(name);
    16
    name = trimSeparator(name);
    11
    dirEntries.put(name, r);
    17
    dirEntries.put(name, r);
    12
    if (match(name))
    18
    if (match(name))
    13
    matchDirEntries.put(name, r);
    19
    matchDirEntries.put(name, r);
    else
    else
    14
    fileEntries.put(name, r);
    20
    fileEntries.put(name, r);
    15
    if (match(name))
    21
    if (match(name))
    16
    matchFileEntries.put(name, r);
    22
    matchFileEntries.put(name, r);
    Precondition Violations (2)
    Row Violation
    1Type org.apache.tools.tar.TarEntry of variable entry does not match with type org.apache.tools.zip.ZipEntry of variable entry
    2Type org.apache.tools.tar.TarEntry of variable entry does not match with type org.apache.tools.zip.ZipEntry of variable entry