catalog.setRefid(new Reference("catalog"));
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.setRefid(new Reference("catalog2"));
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: 4
|
|
1 | catalog.setRefid(new Reference("catalog"));↵ | | 1 | catalog1.setRefid(new Reference("catalog2"));↵
|
|
2 | try {↵ | | 2 | try {↵
|
3 | InputSource result = catalog.resolveEntity("PUBLIC ID ONE",↵ | | 3 | InputSource result = catalog1.resolveEntity("PUBLIC ID ONE",↵
|
4 | "i/dont/exist.dtd");↵ | | 4 | "i/dont/exist.dtd");↵
|
5 | fail("Can make XMLCatalog a Reference to itself.");↵ | | 5 | fail("Can make circular reference");↵
|
6 | } catch (BuildException be) {↵ | | 6 | } catch (BuildException be) {↵
|
7 | assertEquals("This data type contains a circular reference.",↵ | | 7 | assertEquals("This data type contains a circular reference.",↵
|
8 | be.getMessage());↵ | | 8 | be.getMessage());↵
|
9 | } catch (Exception e) {↵ | | 9 | } catch (Exception e) {↵
|
10 | fail("resolveEntity() failed!" + e.toString());↵ | | 10 | fail("resolveEntity() failed!" + e.toString());↵
|
11 | } | | 11 | }
|
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.3 |
Clones location | Clones are in the same method |
Number of node comparisons | 10 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | catalog.setRefid(new Reference("catalog")); | | 14 | catalog1.setRefid(new Reference("catalog2")); |
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"); |
Precondition Violations (0)
Row |
Violation |