File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/services/FileServer.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/services/FileServer.java | |||
Method name: BufferedWriter createBufferedWriter(FileEntry, String)
|
Method name: BufferedReader createBufferedReader(FileEntry, String)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | FileOutputStream fos = new FileOutputStream(fileEntry.file); ↵ | 1 | FileInputStream fis = new FileInputStream(fileEntry.file); ↵ | |
2 | OutputStreamWriter osw = null;↵ | 2 | InputStreamReader isr = null;↵ | |
3 | // If file encoding is specified, write using that encoding, otherwise use default platform encoding↵ | 3 | // If file encoding is specified, read using that encoding, otherwise use default platform encoding↵ | |
4 | String charsetName = fileEntry.charSetEncoding;↵ | 4 | String charsetName = fileEntry.charSetEncoding;↵ | |
5 | if(charsetName != null && charsetName.trim().length() > 0) {↵ | 5 | if(charsetName != null && charsetName.trim().length() > 0) {↵ | |
6 | osw = new OutputStreamWriter(fos, charsetName); ↵ | 6 | isr = new InputStreamReader(fis, charsetName); ↵ | |
7 | } else {↵ | 7 | } else {↵ | |
8 | osw = new OutputStreamWriter(fos); ↵ | 8 | isr = new InputStreamReader(fis); ↵ | |
9 | }↵ | 9 | }↵ | |
10 | return new BufferedWriter(osw); | 10 | return new BufferedReader(isr); | |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 25 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
| 1 | FileInputStream fis = new FileInputStream(fileEntry.file); | |||||
1 | FileOutputStream fos = new FileOutputStream(fileEntry.file); | | |||||
| 2 | InputStreamReader isr = null; | |||||
2 | OutputStreamWriter osw = null; | | |||||
3 | String charsetName = fileEntry.charSetEncoding; | 3 | String charsetName = fileEntry.charSetEncoding; | ||||
4 | if (charsetName != null && charsetName.trim().length() > 0) | 4 | if (charsetName != null && charsetName.trim().length() > 0) | ||||
|
| 5 | isr = new InputStreamReader(fis, charsetName); | ||||
5 | osw = new OutputStreamWriter(fos, charsetName); |
| | ||||
else | | ||||||
| 6 | isr = new InputStreamReader(fis); | |||||
6 | osw = new OutputStreamWriter(fos); | | |||||
|
| 7 | return new BufferedReader(isr); | ||||
7 | return new BufferedWriter(osw); |
| |
Row | Violation |
---|---|
1 | Unmatched statement isr=new InputStreamReader(fis,charsetName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement osw=new OutputStreamWriter(fos,charsetName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched return new BufferedReader(isr); |
4 | Unmatched return new BufferedWriter(osw); |