FileWriter out = null;
try {
out = new FileWriter(crashFile);
out.write(Constants.TERMINATED_SUCCESSFULLY + "\n");
out.flush();
} finally {
if (out != null) {
out.close();
}
}
try {
FileWriter out = null;
try {
out = new FileWriter(crashFile);
out.write(testCase + "\n");
out.flush();
} finally {
if (out != null) {
out.close();
}
}
} catch (IOException e) {
// ignored.
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
|
Method name: void registerNonCrash()
|
|
Method name: void registerTestCase(String)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 6
|
|
| | | 1 | try {↵
|
1 | FileWriter out = null;↵ | | 2 | FileWriter out = null;↵
|
2 | try {↵ | | 3 | try {↵
|
3 | out = new FileWriter(crashFile);↵ | | 4 | out = new FileWriter(crashFile);↵
|
4 | out.write(Constants.TERMINATED_SUCCESSFULLY + "\n");↵ | | 5 | out.write(testCase + "\n");↵
|
5 | out.flush();↵ | | 6 | out.flush();↵
|
6 | } finally {↵ | | 7 | } finally {↵
|
7 | if (out != null) {↵ | | 8 | if (out != null) {↵
|
8 | out.close();↵ | | 9 | out.close();↵
|
9 | }↵ | | 10 | }↵
|
| | | 11 | }↵
|
| | | 12 | } catch (IOException e) {↵
|
| | | 13 | // ignored.↵
|
10 | } | | 14 | }
|
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 18 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
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.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | FileWriter out = null; | | 3 | FileWriter out = null; |
3 | try | | 4 | try |
4 | out = new FileWriter(crashFile); | | 5 | out = new FileWriter(crashFile); |
5 | out.write(Constants.TERMINATED_SUCCESSFULLY + "\n"); | | 6 | out.write(testCase + "\n"); |
6 | | | 7 | |
Precondition Violations (0)
Row |
Violation |