File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/CharacterArrayType.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/WrapperBinaryType.java | |||
Method name: Object toExternalFormat(char[])
|
Method name: Object toExternalFormat(byte[])
|
|||
Number of AST nodes: 6 | Number of AST nodes: 7 | |||
1 | if (chars == null) return null;↵ | 1 | if (bytes == null) return null;↵ | |
2 | Character[] characters↵ | 2 | int length = bytes.length;↵ | |
3 | = new Character[chars.length];↵ | 3 | Byte[] result = new Byte[length];↵ | |
4 | for (int i = 0 ; i < chars.length ; i++) {↵ | 4 | for ( int index = 0; index < length ; index++ ) {↵ | |
5 | characters[i] = new Character( chars[i] );↵ | 5 | result[index] = new Byte( bytes[index] );↵ | |
6 | }↵ | 6 | }↵ | |
7 | return characters; | 7 | return result; | |
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 19 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (chars == null) |
| 1 | if (bytes == null) | |||||||||||||||||||
2 | return null; | 2 | return null; | ||||||||||||||||||||
| 3 | int length = bytes.length; | |||||||||||||||||||||
3 | Character[] characters = new Character[chars.length]; | | |||||||||||||||||||||
| 4 | Byte[] result = new Byte[length]; | |||||||||||||||||||||
4 | for (int i = 0; i < chars.length; i++) |
| 5 | for (int index = 0; index < length; index++) | |||||||||||||||||||
5 | characters[i] = new Character(chars[i]); |
| | ||||||||||||||||||||
|
| 6 | result[index] = new Byte(bytes[index]); | ||||||||||||||||||||
6 | return characters; |
| | ||||||||||||||||||||
|
| 7 | return result; |
Row | Violation |
---|---|
1 | Type char[] of variable chars does not match with type byte[] of variable bytes |
2 | Unmatched statement characters[i]=new Character(chars[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement result[index]=new Byte(bytes[index]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return characters; |
5 | Unmatched return result; |