f = (ZipFileSet)getInstance(); f.setSrc(new File("example.zip")); 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 = (ZipFileSet)getInstance(); f.setSrc(new File("example.zip")); 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 = (ZipFileSet)getInstance();
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/ZipFileSetTest.java
Method name: void testAttributes() Method name: void testAttributes()
Number of AST nodes: 7 Number of AST nodes: 7
1
f = (ZipFileSet)getInstance();
1
f = (ZipFileSet)getInstance();
2
        f.setSrc(new File("example.zip"));
2
        f.setSrc(new File("example.zip"));
3
        f.setFullpath("/doc/manual/index.html");
3
        f.setPrefix("/examples");
4
        try {
4
        try {
5
            f.setPrefix("/examples");
5
            f.setFullpath("/doc/manual/index.html");
6
            fail("Can add prefix to "
6
            fail("Can add fullpath to "
7
                    + f.getDataTypeName()
7
                    + f.getDataTypeName()
8
                    + " when a fullpath is already present");
8
                    + " when a prefix is already present");
9
        } catch (BuildException be) {
9
        } catch (BuildException be) {
10
            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
10
            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
11
        }
11
        }
12
        // check that reference zipfilesets cannot have specific attributes
13
        f = (ZipFileSet)getInstance();
12
        f = (ZipFileSet)getInstance();
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 the same method
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                    
    11
    f = (ZipFileSet)getInstance();
    17
    f = (ZipFileSet)getInstance();
    17
    f = (ZipFileSet)getInstance();
    18
    f.setSrc(new File("example.zip"));
    12
    f.setSrc(new File("example.zip"));
    19
    f.setFullpath("/doc/manual/index.html");
    19
    f.setFullpath("/doc/manual/index.html");
    13
    f.setPrefix("/examples");
    Differences
    Expression1Expression2Difference
    setFullpathsetPrefixMETHOD_INVOCATION_NAME_MISMATCH
    "/doc/manual/index.html""/examples"LITERAL_VALUE_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.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
    setPrefixsetFullpathMETHOD_INVOCATION_NAME_MISMATCH
    "/examples""/doc/manual/index.html"LITERAL_VALUE_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
    16
    fail("Can add fullpath to " + f.getDataTypeName() + " when a prefix is already present");
    23
    f = (ZipFileSet)getInstance();
    17
    f = (ZipFileSet)getInstance();
    Precondition Violations (7)
    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.setFullpath("/doc/manual/index.html") is a void method call, and thus it cannot be parameterized
    3Expression f.setPrefix("/examples") is a void method call, and thus it cannot be parameterized
    4Expression f.setPrefix("/examples") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression f.setFullpath("/doc/manual/index.html") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression f.setPrefix("/examples") is a void method call, and thus it cannot be parameterized
    7Expression f.setFullpath("/doc/manual/index.html") is a void method call, and thus it cannot be parameterized