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(); | | | |
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in the same method |
Number of node comparisons | 9 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 15 | try |
4 | InputSource result = catalog.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd"); | | 16 | InputSource result = catalog1.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd"); |
5 | fail("Can make XMLCatalog a Reference to itself."); | | 17 | fail("Can make circular reference"); |
6 | XMLCatalog catalog1 = newCatalog(); | | | |
Precondition Violations (0)
Row |
Violation |