FileWriter out = null;
try {
out = new FileWriter(crashFile);
out.write(testCase + "\n");
out.flush();
} finally {
if (out != null) {
out.close();
}
}
FileWriter out = null;
try {
out = new FileWriter(crashFile);
out.write(Constants.TERMINATED_SUCCESSFULLY + "\n");
out.flush();
} finally {
if (out != null) {
out.close();
}
}
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 registerTestCase(String)
|
|
Method name: void registerNonCrash()
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | FileWriter out = null;↵ | | 1 | FileWriter out = null;↵
|
2 | try {↵ | | 2 | try {↵
|
3 | out = new FileWriter(crashFile);↵ | | 3 | out = new FileWriter(crashFile);↵
|
4 | out.write(testCase + "\n");↵ | | 4 | out.write(Constants.TERMINATED_SUCCESSFULLY + "\n");↵
|
5 | out.flush();↵ | | 5 | out.flush();↵
|
6 | } finally {↵ | | 6 | } finally {↵
|
7 | if (out != null) {↵ | | 7 | if (out != null) {↵
|
8 | out.close();↵ | | 8 | out.close();↵
|
9 | }↵ | | 9 | ↵
|
10 | ↵ | | 10 | }↵
|
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.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) | 3.2 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | FileWriter out = null; | | 2 | FileWriter out = null; |
4 | try | | 3 | try |
5 | out = new FileWriter(crashFile); | | 4 | out = new FileWriter(crashFile); |
6 | out.write(testCase + "\n"); | | 5 | out.write(Constants.TERMINATED_SUCCESSFULLY + "\n"); |
7 | | | 6 | |
Precondition Violations (0)
Row |
Violation |