File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/pretty/MessageHelper.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/AbstractBynaryType.java | |||
Method name: String collectionInfoString(CollectionPersister, Serializable[], SessionFactoryImplementor)
|
Method name: String toString(Object)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 5 | |||
1 | for ( int i = 0; i < ids.length; i++ ) {↵ | 1 | for ( int i=0; i<bytes.length; i++ ) { ↵ | |
2 | // Need to use the identifier type of the collection owner↵ | 2 | ↵ | |
3 | // since the incoming is value is actually the owner's id.↵ | |||
4 | // Using the collection's key type causes problems with↵ | |||
5 | // property-ref keys...↵ | |||
6 | s.append( persister.getOwnerEntityPersister().getIdentifierType().toLoggableString( ids[i], factory ) );↵ | 3 | String hexStr = Integer.toHexString( bytes[i] - Byte.MIN_VALUE ); ↵ | |
7 | if ( i < ids.length-1 ) {↵ | 4 | if ( hexStr.length()==1 ) buf.append('0'); ↵ | |
8 | s.append( ", " );↵ | 5 | buf.append(↵ | |
9 | }↵ | |||
10 | ↵ | 6 | hexStr);↵ | |
11 | } | 7 |
| |
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 | 10 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 10.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | for (int i = 0; i < ids.length; i++) |
| 3 | for (int i = 0; i < bytes.length; i++) | ||||||||||||||||||||
|
| 4 | String hexStr = Integer.toHexString(bytes[i] - Byte.MIN_VALUE); | |||||||||||||||||||||
8 | s.append(persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i], factory)); |
| 7 | buf.append(hexStr); | ||||||||||||||||||||
9 | if (i < ids.length - 1) |
| 5 | if (hexStr.length() == 1) | ||||||||||||||||||||
| 6 | buf.append('0'); | ||||||||||||||||||||||
10 | s.append(", "); | |
Row | Violation |
---|---|
1 | Type int of variable ids.length does not match with type int of variable bytes.length |
2 | Unmatched statement String hexStr=Integer.toHexString(bytes[i] - Byte.MIN_VALUE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i],factory) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression hexStr cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression hexStr.length() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression i < ids.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression hexStr.length() == 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables i |