try {
f.getDir(project);
fail("Can make FileList a Reference to itself.");
} catch (BuildException be) {
assertEquals("This data type contains a circular reference.",
be.getMessage());
}
try {
f.getFiles(project);
fail("Can make FileList a Reference to itself.");
} catch (BuildException be) {
assertEquals("This data type contains a circular reference.",
be.getMessage());
}
// dummy1 --> dummy2 --> dummy3 --> dummy1
FileList f1 = new FileList();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/FileListTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/FileListTest.java
|
Method name: void testCircularReferenceCheck()
|
|
Method name: void testCircularReferenceCheck()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 4
|
|
1 | try {↵ | | 1 | try {↵
|
2 | f.getDir(project);↵ | | 2 | f.getFiles(project);↵
|
3 | fail("Can make FileList a Reference to itself.");↵ | | 3 | fail("Can make FileList a Reference to itself.");↵
|
4 | } catch (BuildException be) {↵ | | 4 | } catch (BuildException be) {↵
|
5 | assertEquals("This data type contains a circular reference.",↵ | | 5 | assertEquals("This data type contains a circular reference.",↵
|
6 | be.getMessage());↵ | | 6 | be.getMessage());↵
|
7 | } | | 7 | }↵
|
|
| | | 8 | // dummy1 --> dummy2 --> dummy3 --> dummy1↵
|
| | | 9 | FileList f1 = new FileList();
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in the same method |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.7 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | try | | 7 | try |
5 | | | | |
| | | 8 | |
6 | fail("Can make FileList a Reference to itself."); | | 9 | fail("Can make FileList a Reference to itself."); |
| | | 10 | FileList f1 = new FileList(); |
Precondition Violations (1)
Row |
Violation |
1 | Unmatched statement f.getFiles(project); 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 |