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 testEmptyCatalog()
|
Method name: void testNonExistentEntry()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | try {↵ | 1 | try {↵ | |
2 | Source result = catalog.resolve("i/dont/exist.dtd", null);↵ | 2 | Source result = catalog.resolve("i/dont/exist.dtd", null);↵ | |
3 | String expected = toURLString(new File(project.getBaseDir() +↵ | 3 | String expected = toURLString(new File(project.getBaseDir().toURL() +↵ | |
4 | "/i/dont/exist.dtd"));↵ | 4 | "/i/dont/exist.dtd"));↵ | |
5 | //↵ | 5 | ↵ | |
6 | // These shenanigans are necessary b/c Norm Walsh's resolver↵ | |||
7 | // has a different idea of how file URLs are created on windoze↵ | |||
8 | // ie file://c:/foo instead of file:///c:/foo↵ | |||
9 | //↵ | |||
10 | String resultStr = new URL(((SAXSource)result).getInputSource().getSystemId()).getFile();↵ | 6 | String resultStr = new URL(((SAXSource)result).getInputSource().getSystemId()).getFile();↵ | |
11 | assertTrue("Empty catalog should return input",↵ | 7 | assertTrue("Nonexistent Catalog entry return input",↵ | |
12 | expected.endsWith(resultStr));↵ | 8 | expected.endsWith(resultStr));↵ | |
13 | } catch (Exception e) {↵ | 9 | } catch (Exception e) {↵ | |
14 | fail("resolve() failed!" + e.toString());↵ | 10 | fail("resolve() failed!" + e.toString());↵ | |
15 | } | 11 | } | |
See real code fragment | See real code fragment |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 25 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 40.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | try | 7 | try | |||||||||||
5 | Source result = catalog.resolve("i/dont/exist.dtd", null); | 8 | Source result = catalog.resolve("i/dont/exist.dtd", null); | |||||||||||
6 | String expected = toURLString(new File(project.getBaseDir() + "/i/dont/exist.dtd")); |
| | |||||||||||
|
| 9 | String expected = toURLString(new File(project.getBaseDir().toURL() + "/i/dont/exist.dtd")); | |||||||||||
7 | String resultStr = new URL(((SAXSource)result).getInputSource().getSystemId()).getFile(); | 10 | String resultStr = new URL(((SAXSource)result).getInputSource().getSystemId()).getFile(); | |||||||||||
8 | assertTrue("Empty catalog should return input", expected.endsWith(resultStr)); |
| 11 | assertTrue("Nonexistent Catalog entry return input", expected.endsWith(resultStr)); |
Row | Violation |
---|---|
1 | Unmatched statement String expected=toURLString(new File(project.getBaseDir() + "/i/dont/exist.dtd")); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement String expected=toURLString(new File(project.getBaseDir() + "/i/dont/exist.dtd")); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
3 | Unmatched statement String expected=toURLString(new File(project.getBaseDir().toURL() + "/i/dont/exist.dtd")); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement String expected=toURLString(new File(project.getBaseDir().toURL() + "/i/dont/exist.dtd")); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |