try { f1.getDir(project); fail("Can make circular reference."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); } try { f1.getFiles(project); fail("Can make circular reference."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); }
try { p1.getIncludePatterns(project); fail("Can make circular reference."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); } try { p1.getExcludePatterns(project); fail("Can make circular reference."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/FileListTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java
Method name: void testCircularReferenceCheck() Method name: void testCircularReferenceCheck()
Number of AST nodes: 6 Number of AST nodes: 6
1
try {
1
try {
2
            f1.getDir(project);
2
            p1.getIncludePatterns(project);
3
            fail("Can make circular reference.");
3
            fail("Can make circular reference.");
4
        } catch (BuildException be) {
4
        } catch (BuildException be) {
5
            assertEquals("This data type contains a circular reference.",
5
            assertEquals("This data type contains a circular reference.",
6
                         be.getMessage());
6
                         be.getMessage());
7
        }
7
        }
8
        try {
8
        try {
9
            f1.getFiles(project);
9
            p1.getExcludePatterns(project);
10
            fail("Can make circular reference.");
10
            fail("Can make circular reference.");
11
        } catch (BuildException be) {
11
        } catch (BuildException be) {
12
            assertEquals("This data type contains a circular reference.",
12
            assertEquals("This data type contains a circular reference.",
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 different classes having the same super class
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    19
    try
    19
    try
                                                                          
    20
    p1.getIncludePatterns(project);
    20
    f1.getDir(project);
                                                  
    21
    fail("Can make circular reference.");
    21
    fail("Can make circular reference.");
    22
    try
    22
    try
    23
    f1.getFiles(project);
    23
    f1.getFiles(project);
    23
    p1.getExcludePatterns(project);
    Differences
    Expression1Expression2Difference
    getFilesgetExcludePatternsMETHOD_INVOCATION_NAME_MISMATCH
    f1p1VARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.FileListorg.apache.tools.ant.types.PatternSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression f1.getFiles(project) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression p1.getExcludePatterns(project) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    23
    p1.getExcludePatterns(project);
    24
    fail("Can make circular reference.");
    24
    fail("Can make circular reference.");
    Precondition Violations (2)
    Row Violation
    1Expression f1.getFiles(project) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression p1.getExcludePatterns(project) is a method call throwing exception(s) that should be caught by a try block that will be extracted