File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/PropertyFile.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java | |||
Method name: void readFile()
|
Method name: void registerNonCrash()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | log("Creating new property file: "↵ | |||
2 | + propertyfile.getAbsolutePath());↵ | |||
3 | FileOutputStream out = null;↵ | 1 | FileWriter out = null;↵ | |
4 | try {↵ | 2 | try {↵ | |
5 | out = new FileOutputStream(propertyfile.getAbsolutePath());↵ | 3 | out = new File↵ | |
6 | ↵ | 4 | Writer(crashFile);↵ | |
5 | out.write(Constants.TERMINATED_SUCCESSFULLY + "\n");↵ | |||
7 | out.flush();↵ | 6 | out.flush();↵ | |
8 | } finally {↵ | 7 | } finally {↵ | |
9 | if (out != null) {↵ | 8 | if (out != null) {↵ | |
10 | out.close();↵ | 9 | out.close();↵ | |
11 | }↵ | 10 | ↵ | |
12 | ↵ | 11 | }↵ | |
13 | } | 12 |
| |
See real code fragment | See real code fragment |
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 different classes |
Number of node comparisons | 14 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | FileWriter out = null; | |||||||||||||||||
10 | log("Creating new property file: " + propertyfile.getAbsolutePath()); | | |||||||||||||||||
11 | FileOutputStream out = null; | | |||||||||||||||||
12 | try |
| 3 | try | |||||||||||||||
| 4 | out = new FileWriter(crashFile); | |||||||||||||||||
|
| 5 | out.write(Constants.TERMINATED_SUCCESSFULLY + "\n"); | ||||||||||||||||
13 | out = new FileOutputStream(propertyfile.getAbsolutePath()); | | |||||||||||||||||
14 | out.flush(); |
| 6 | out.flush(); |
Row | Violation |
---|---|
1 | Type java.io.FileOutputStream of variable out does not match with type java.io.FileWriter of variable out |
2 | Type java.io.FileOutputStream of variable out does not match with type java.io.FileWriter of variable out |
3 | Unmatched statement out.write(Constants.TERMINATED_SUCCESSFULLY + "\n"); 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 |
4 | Type java.io.FileOutputStream of variable out does not match with type java.io.FileWriter of variable out |