f.setFullpath("/doc/manual/index.html"); try { f.setPrefix("/examples"); fail("Can add prefix to " + f.getDataTypeName() + " when a fullpath is already present"); } catch (BuildException be) { assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage()); } // check that reference zipfilesets cannot have specific attributes f = (ZipFileSet)getInstance(); f.setRefid(new Reference("test"));
f.setPrefix("/examples"); try { f.setFullpath("/doc/manual/index.html"); fail("Can add fullpath to " + f.getDataTypeName() + " when a prefix is already present"); } catch (BuildException be) { assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage()); } f = (TarFileSet)getInstance(); f.setSrc(new File("example.tar"));
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
Method name: void testAttributes() Method name: void testAttributes()
Number of AST nodes: 6 Number of AST nodes: 6
1
f.setFullpath("/doc/manual/index.html");
1
f.setPrefix("/examples");
2
        try {
2
        try {
3
            f.setPrefix("/examples");
3
            f.setFullpath("/doc/manual/index.html");
4
            fail("Can add prefix to "
4
            fail("Can add fullpath to "
5
                    + f.getDataTypeName()
5
                    + f.getDataTypeName()
6
                    + " when a fullpath is already present");
6
                    + " when a prefix is already present");
7
        } catch (BuildException be) {
7
        } catch (BuildException be) {
8
            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
8
            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
9
        }
9
        }
10
        // check that reference zipfilesets cannot have specific attributes
10
        
11
        f = (ZipFileSet)getInstance();
11
f = (TarFileSet)getInstance();
12
        f.setRefid(new Reference("test"));
12
        f.setSrc(new File("example.tar"));
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 comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)76.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    19
    f.setFullpath("/doc/manual/index.html");
    19
    f.setFullpath("/doc/manual/index.html");
    13
    f.setPrefix("/examples");
    Differences
    Expression1Expression2Difference
    "/doc/manual/index.html""/examples"LITERAL_VALUE_MISMATCH
    setFullpathsetPrefixMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.types.TarFileSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression f.setFullpath("/doc/manual/index.html") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression f.setPrefix("/examples") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression f.setFullpath("/doc/manual/index.html") is a void method call, and thus it cannot be parameterized
    Expression f.setPrefix("/examples") is a void method call, and thus it cannot be parameterized
    13
    f.setPrefix("/examples");
    20
    try
    14
    try
    21
    f.setPrefix("/examples");
    21
    f.setPrefix("/examples");
    15
    f.setFullpath("/doc/manual/index.html");
    Differences
    Expression1Expression2Difference
    "/examples""/doc/manual/index.html"LITERAL_VALUE_MISMATCH
    setPrefixsetFullpathMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.types.TarFileSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression f.setPrefix("/examples") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression f.setFullpath("/doc/manual/index.html") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression f.setPrefix("/examples") is a void method call, and thus it cannot be parameterized
    Expression f.setFullpath("/doc/manual/index.html") is a void method call, and thus it cannot be parameterized
    15
    f.setFullpath("/doc/manual/index.html");
    22
    fail("Can add prefix to " + f.getDataTypeName() + " when a fullpath is already present");
    22
    fail("Can add prefix to " + f.getDataTypeName() + " when a fullpath is already present");
    16
    fail("Can add fullpath to " + f.getDataTypeName() + " when a prefix is already present");
    Differences
    Expression1Expression2Difference
    " when a fullpath is already present"" when a prefix is already present"LITERAL_VALUE_MISMATCH
    "Can add prefix to ""Can add fullpath to "LITERAL_VALUE_MISMATCH
    org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.types.TarFileSetSUBCLASS_TYPE_MISMATCH
    16
    fail("Can add fullpath to " + f.getDataTypeName() + " when a prefix is already present");
    23
    f = (ZipFileSet)getInstance();
    23
    f = (ZipFileSet)getInstance();
    17
    f = (TarFileSet)getInstance();
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.types.TarFileSetSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.types.TarFileSetSUBCLASS_TYPE_MISMATCH
    17
    f = (TarFileSet)getInstance();
    24
    f.setRefid(new Reference("test"));
    24
    f.setRefid(new Reference("test"));
    18
    f.setSrc(new File("example.tar"));
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.Referencejava.io.FileVARIABLE_TYPE_MISMATCH
    "test""example.tar"LITERAL_VALUE_MISMATCH
    setRefidsetSrcMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.ZipFileSetorg.apache.tools.ant.types.TarFileSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.types.Reference does not match with type java.io.File
    • Make classes org.apache.tools.ant.types.Reference and java.io.File extend a common superclass
    Expression f.setRefid(new Reference("test")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression f.setSrc(new File("example.tar")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression f.setRefid(new Reference("test")) is a void method call, and thus it cannot be parameterized
    Expression f.setSrc(new File("example.tar")) is a void method call, and thus it cannot be parameterized
    18
    f.setSrc(new File("example.tar"));
    Precondition Violations (14)
    Row Violation
    1Expression f.setFullpath("/doc/manual/index.html") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression f.setPrefix("/examples") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression f.setFullpath("/doc/manual/index.html") is a void method call, and thus it cannot be parameterized
    4Expression f.setPrefix("/examples") is a void method call, and thus it cannot be parameterized
    5Expression f.setPrefix("/examples") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression f.setFullpath("/doc/manual/index.html") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression f.setPrefix("/examples") is a void method call, and thus it cannot be parameterized
    8Expression f.setFullpath("/doc/manual/index.html") is a void method call, and thus it cannot be parameterized
    9Type org.apache.tools.ant.types.Reference does not match with type java.io.File
    10Expression f.setRefid(new Reference("test")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression f.setSrc(new File("example.tar")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression f.setRefid(new Reference("test")) is a void method call, and thus it cannot be parameterized
    13Expression f.setSrc(new File("example.tar")) is a void method call, and thus it cannot be parameterized
    14Clone fragment #1 returns variable f with type org.apache.tools.ant.types.ZipFileSet , while Clone fragment #2 returns variable f with type org.apache.tools.ant.types.TarFileSet