try { p.addFileset(new FileSet()); fail("Can add nested FileSet in Path that is a reference."); } catch (BuildException be) { assertEquals("You must not specify nested elements when using refid", be.getMessage()); } try { p.addFilelist(new FileList()); fail("Can add nested FileList in Path that is a reference."); } catch (BuildException be) { assertEquals("You must not specify nested elements when using refid", be.getMessage()); }
try { p.addFilelist(new FileList()); fail("Can add nested FileList in Path that is a reference."); } catch (BuildException be) { assertEquals("You must not specify nested elements when using refid", be.getMessage()); } try { p.addDirset(new DirSet()); fail("Can add nested Dirset in Path that is a reference."); } catch (BuildException be) { assertEquals("You must not specify nested elements when using refid", be.getMessage()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/PathTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/PathTest.java
Method name: void testEmptyElementIfIsReference() Method name: void testEmptyElementIfIsReference()
Number of AST nodes: 6 Number of AST nodes: 6
1
try {
1
try {
2
            p.addFileset(new FileSet());
2
            p.addFilelist(new FileList());
3
            fail("Can add nested FileSet in Path that is a reference.");
3
            fail("Can add nested FileList in Path that is a reference.");
4
        } catch (BuildException be) {
4
        } catch (BuildException be) {
5
            assertEquals("You must not specify nested elements when using refid",
5
            assertEquals("You must not specify nested elements when using refid",
6
                         be.getMessage());
6
                         be.getMessage());
7
        }
7
        }
8
        try {
8
        try {
9
            p.addFilelist(new FileList());
9
            p.addDirset(new DirSet());
10
            fail("Can add nested FileList in Path that is a reference.");
10
            fail("Can add nested Dirset in Path that is a reference.");
11
        } catch (BuildException be) {
11
        } catch (BuildException be) {
12
            assertEquals("You must not specify nested elements when using refid",
12
            assertEquals("You must not specify nested elements when using refid",
13
                         be.getMessage());
13
                         be.getMessage());
14
        }
14
        }
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.4
Clones locationClones are in the same method
Number of node comparisons28
  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)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    26
    try
    29
    try
    27
    p.addFileset(new FileSet());
    27
    p.addFileset(new FileSet());
    30
    p.addFilelist(new FileList());
    Differences
    Expression1Expression2Difference
    addFilesetaddFilelistMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.FileSetorg.apache.tools.ant.types.FileListSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression p.addFileset(new FileSet()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression p.addFilelist(new FileList()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression p.addFileset(new FileSet()) is a void method call, and thus it cannot be parameterized
    Expression p.addFilelist(new FileList()) is a void method call, and thus it cannot be parameterized
    30
    p.addFilelist(new FileList());
    28
    fail("Can add nested FileSet in Path that is a reference.");
    28
    fail("Can add nested FileSet in Path that is a reference.");
    31
    fail("Can add nested FileList in Path that is a reference.");
    Differences
    Expression1Expression2Difference
    "Can add nested FileSet in Path that is a reference.""Can add nested FileList in Path that is a reference."LITERAL_VALUE_MISMATCH
    31
    fail("Can add nested FileList in Path that is a reference.");
    29
    try
    32
    try
    30
    p.addFilelist(new FileList());
    30
    p.addFilelist(new FileList());
    33
    p.addDirset(new DirSet());
    Differences
    Expression1Expression2Difference
    addFilelistaddDirsetMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.FileListorg.apache.tools.ant.types.DirSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression p.addFilelist(new FileList()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.addDirset(new DirSet()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.addFilelist(new FileList()) is a void method call, and thus it cannot be parameterized
    Expression p.addDirset(new DirSet()) is a void method call, and thus it cannot be parameterized
    33
    p.addDirset(new DirSet());
    31
    fail("Can add nested FileList in Path that is a reference.");
    31
    fail("Can add nested FileList in Path that is a reference.");
    34
    fail("Can add nested Dirset in Path that is a reference.");
    Differences
    Expression1Expression2Difference
    "Can add nested FileList in Path that is a reference.""Can add nested Dirset in Path that is a reference."LITERAL_VALUE_MISMATCH
    34
    fail("Can add nested Dirset in Path that is a reference.");
    Precondition Violations (8)
    Row Violation
    1Expression p.addFileset(new FileSet()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression p.addFilelist(new FileList()) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Expression p.addFileset(new FileSet()) is a void method call, and thus it cannot be parameterized
    4Expression p.addFilelist(new FileList()) is a void method call, and thus it cannot be parameterized
    5Expression p.addFilelist(new FileList()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression p.addDirset(new DirSet()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression p.addFilelist(new FileList()) is a void method call, and thus it cannot be parameterized
    8Expression p.addDirset(new DirSet()) is a void method call, and thus it cannot be parameterized