try { InputSource result = catalog.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd"); fail("Can make XMLCatalog a Reference to itself."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); } catch (Exception e) { fail("resolveEntity() failed!" + e.toString()); } // catalog1 --> catalog2 --> catalog3 --> catalog1 XMLCatalog catalog1 = newCatalog();
try { InputSource result = catalog1.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd"); fail("Can make circular reference"); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); } catch (Exception e) { fail("resolveEntity() failed!" + e.toString()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
Method name: void testCircularReferenceCheck() Method name: void testCircularReferenceCheck()
Number of AST nodes: 4 Number of AST nodes: 3
1
try {
1
try {
2
            InputSource result = catalog.resolveEntity("PUBLIC ID ONE",
2
            InputSource result = catalog1.resolveEntity("PUBLIC ID ONE",
3
                                                       "i/dont/exist.dtd");
3
                                                        "i/dont/exist.dtd");
4
            fail("Can make XMLCatalog a Reference to itself.");
4
            fail("Can make circular reference");
5
        } catch (BuildException be) {
5
        } catch (BuildException be) {
6
            assertEquals("This data type contains a circular reference.",
6
            assertEquals("This data type contains a circular reference.",
7
                         be.getMessage());
7
                         be.getMessage());
8
        } catch (Exception e) {
8
        } catch (Exception e) {
9
            fail("resolveEntity() failed!" + e.toString());
9
            fail("resolveEntity() failed!" + e.toString());
10
        }
10
        }
11
        // catalog1 --> catalog2 --> catalog3 --> catalog1
12
        XMLCatalog catalog1 = newCatalog();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in the same method
Number of node comparisons9
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    try
    15
    try
    4
    InputSource result = catalog.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd");
    4
    InputSource result = catalog.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd");
    16
    InputSource result = catalog1.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd");
    Differences
    Expression1Expression2Difference
    catalogcatalog1VARIABLE_NAME_MISMATCH
    16
    InputSource result = catalog1.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd");
    5
    fail("Can make XMLCatalog a Reference to itself.");
    5
    fail("Can make XMLCatalog a Reference to itself.");
    17
    fail("Can make circular reference");
    Differences
    Expression1Expression2Difference
    "Can make XMLCatalog a Reference to itself.""Can make circular reference"LITERAL_VALUE_MISMATCH
    17
    fail("Can make circular reference");
    6
    XMLCatalog catalog1 = newCatalog();
                                                                            
    Precondition Violations (0)
    Row Violation