File path: /apache-ant-1.7.0/src/org/apache/tools/zip/ZipOutputStream.java | File path: /apache-ant-1.7.0/src/org/apache/tools/zip/ZipFile.java | |||
Method name: byte[] getBytes(String)
|
Method name: String getString(byte[])
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | if (encoding == null) {↵ | 1 | if (encoding == null) {↵ | |
2 | return name.getBytes();↵ | 2 | return new String(bytes);↵ | |
3 | } else {↵ | 3 | } else {↵ | |
4 | try {↵ | 4 | try {↵ | |
5 | return name.getBytes(encoding);↵ | 5 | return new String(bytes, encoding);↵ | |
6 | } catch (UnsupportedEncodingException uee) {↵ | 6 | } catch (UnsupportedEncodingException uee) {↵ | |
7 | throw new ZipException(uee.getMessage());↵ | 7 | throw new ZipException(uee.getMessage());↵ | |
8 | }↵ | 8 | }↵ | |
9 | } | 9 |
| |
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 in different classes |
Number of node comparisons | 8 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||
---|---|---|---|---|---|---|---|---|---|
1 | if (encoding == null) | 1 | if (encoding == null) | ||||||
|
| 2 | return new String(bytes); | ||||||
2 | return name.getBytes(); |
| | ||||||
else | else | ||||||||
3 | try | 3 | try | ||||||
|
| 4 | return new String(bytes, encoding); | ||||||
4 | return name.getBytes(encoding); |
| |
Row | Violation |
---|---|
1 | Unmatched return new String(bytes); |
2 | Unmatched return name.getBytes(); |
3 | Unmatched statement return new String(bytes,encoding); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched return new String(bytes,encoding); |
5 | Unmatched statement return name.getBytes(encoding); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched statement return name.getBytes(encoding); 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 |
7 | Unmatched return name.getBytes(encoding); |