try {
InputSource result = catalog1.resolveEntity(publicId,
"nap:chemical+brothers");
assertNotNull(result);
assertEquals(toURLString(dtdFile),
result.getSystemId());
} catch (Exception e) {
fail("resolveEntity() failed!" + e.toString());
}
try {
Source result = catalog.resolve(uri, null);
assertNotNull(result);
assertEquals(toURLString(xmlFile),
result.getSystemId());
} catch (Exception e) {
fail("resolve() failed!" + e.toString());
}
try {
InputSource result = catalog2.resolveEntity(publicId,
"nap:chemical+brothers");
assertNotNull(result);
assertEquals(toURLString(dtdFile),
result.getSystemId());
} catch (Exception e) {
fail("resolveEntity() failed!" + e.toString());
}
try {
Source result = catalog.resolve(uri, null);
assertNotNull(result);
assertEquals(toURLString(xmlFile),
result.getSystemId());
} catch (Exception e) {
fail("resolve() 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 testNestedCatalog()
|
|
Method name: void testEntryReference()
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | try {↵ | | 1 | try {↵
|
2 | InputSource result = catalog1.resolveEntity(publicId,↵ | | 2 | InputSource result = catalog2.resolveEntity(publicId,↵
|
3 | "nap:chemical+brothers");↵ | | 3 | "nap:chemical+brothers");↵
|
|
4 | assertNotNull(result);↵ | | 4 | assertNotNull(result);↵
|
5 | assertEquals(toURLString(dtdFile),↵ | | 5 | assertEquals(toURLString(dtdFile),↵
|
6 | result.getSystemId());↵ | | 6 | result.getSystemId());↵
|
7 | } catch (Exception e) {↵ | | 7 | } catch (Exception e) {↵
|
8 | fail("resolveEntity() failed!" + e.toString());↵ | | 8 | fail("resolveEntity() failed!" + e.toString());↵
|
9 | }↵ | | 9 | }↵
|
|
10 | try {↵ | | 10 | try {↵
|
11 | Source result = catalog.resolve(uri, null);↵ | | 11 | Source result = catalog.resolve(uri, null);↵
|
12 | assertNotNull(result);↵ | | 12 | assertNotNull(result);↵
|
13 | assertEquals(toURLString(xmlFile),↵ | | 13 | assertEquals(toURLString(xmlFile),↵
|
14 | result.getSystemId());↵ | | 14 | result.getSystemId());↵
|
15 | } catch (Exception e) {↵ | | 15 | } catch (Exception e) {↵
|
16 | fail("resolve() failed!" + e.toString());↵ | | 16 | fail("resolve() failed!" + e.toString());↵
|
17 | } | | 17 | }
|
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.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 49 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 8 |
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) | 3.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
17 | try | | 22 | try |
18 | InputSource result = catalog1.resolveEntity(publicId, "nap:chemical+brothers"); | | 23 | InputSource result = catalog2.resolveEntity(publicId, "nap:chemical+brothers"); |
19 | | | 24 | |
20 | assertEquals(toURLString(dtdFile), result.getSystemId()); | | 25 | assertEquals(toURLString(dtdFile), result.getSystemId()); |
21 | try | | 26 | try |
22 | Source result = catalog.resolve(uri, null); | | 27 | Source result = catalog.resolve(uri, null); |
23 | | | 28 | |
24 | assertEquals(toURLString(xmlFile), result.getSystemId()); | | 29 | assertEquals(toURLString(xmlFile), result.getSystemId()); |
Precondition Violations (0)
Row |
Violation |