for ( int i = 0; i < ids.length; i++ ) { // Need to use the identifier type of the collection owner // since the incoming is value is actually the owner's id. // Using the collection's key type causes problems with // property-ref keys... s.append( persister.getOwnerEntityPersister().getIdentifierType().toLoggableString( ids[i], factory ) ); if ( i < ids.length-1 ) { s.append( ", " ); } }
for ( int i=0; i<bytes.length; i++ ) { String hexStr = Integer.toHexString( bytes[i] - Byte.MIN_VALUE ); if ( hexStr.length()==1 ) buf.append('0'); buf.append(hexStr); }
Clone fragments detected by clone detection tool
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
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)10.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    for (int i = 0; i < ids.length; i++)
    7
    for (int i = 0; i < ids.length; i++)
    3
    for (int i = 0; i < bytes.length; i++)
    Differences
    Expression1Expression2Difference
    idsbytesVARIABLE_NAME_MISMATCH
    java.io.Serializable[]byte[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable ids.length does not match with type int of variable bytes.length
    • Make classes java.io.Serializable[] and byte[] extend a common superclass
    3
    for (int i = 0; i < bytes.length; i++)
                                                                                                                                    
    4
    String hexStr = Integer.toHexString(bytes[i] - Byte.MIN_VALUE);
    Preondition Violations
    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
    4
    String hexStr = Integer.toHexString(bytes[i] - Byte.MIN_VALUE);
    8
    s.append(persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i], factory));
    8
    s.append(persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i], factory));
    7
    buf.append(hexStr);
    Differences
    Expression1Expression2Difference
    persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i],factory)hexStrTYPE_COMPATIBLE_REPLACEMENT
    sbufVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i],factory) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression hexStr cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    buf.append(hexStr);
    9
    if (i < ids.length - 1)
    9
    if (i < ids.length - 1)
    5
    if (hexStr.length() == 1)
    Differences
    Expression1Expression2Difference
    ihexStr.length()TYPE_COMPATIBLE_REPLACEMENT
    ids.length - 11INFIX_RIGHT_OPERAND_MISMATCH
    <==OPERATOR_MISMATCH
    Preondition Violations
    Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression hexStr.length() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression i < ids.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression hexStr.length() == 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    if (hexStr.length() == 1)
                                          
    6
    buf.append('0');
    10
    s.append(", ");
                                          
    Precondition Violations (9)
    Row Violation
    1Type int of variable ids.length does not match with type int of variable bytes.length
    2Unmatched 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
    3Expression persister.getOwnerEntityPersister().getIdentifierType().toLoggableString(ids[i],factory) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression hexStr cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression hexStr.length() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression i < ids.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression hexStr.length() == 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Clone fragment #1 returns variables , while Clone fragment #2 returns variables i