for ( int i=0; i<columnNames.length; i++ ) { if ( insertable[i] ) { addColumn( columnNames[i] ); } }
for ( int i = 0; i < types.length; i++ ) { if ( includeProperty[i] ) { values[i] = types[i].hydrate( rs, getPropertyAliases( "", i ), session, null ); //null owner ok?? } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/sql/Insert.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
Method name: Insert addColumns(String[], boolean[]) Method name: Object[] getDatabaseSnapshot(Serializable, SessionImplementor)
Number of AST nodes: 3 Number of AST nodes: 3
1
for ( int i=0; i<columnNames.length; i++ ) {
1
for ( int i = 0; i < types.length; i++ ) {
2
			if ( insertable[i] ) {
2
						if ( includeProperty[i] ) {
3
				addColumn( columnNames[i] );
3
					
4
		values[i] = types[i].hydrate( rs, getPropertyAliases( "", i ), session, null ); //null owner ok??
4
			}
5
						}
5
		}
6
					}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < columnNames.length; i++)
    1
    for (int i = 0; i < columnNames.length; i++)
    14
    for (int i = 0; i < types.length; i++)
    Differences
    Expression1Expression2Difference
    columnNamestypesVARIABLE_NAME_MISMATCH
    java.lang.String[]org.hibernate.type.Type[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable columnNames does not match with type org.hibernate.type.Type[] of variable types
    • Make classes java.lang.String[] and org.hibernate.type.Type[] extend a common superclass
    14
    for (int i = 0; i < types.length; i++)
    2
    if (insertable[i])
    2
    if (insertable[i])
    15
    if (includeProperty[i])
    Differences
    Expression1Expression2Difference
    insertableincludePropertyVARIABLE_NAME_MISMATCH
    15
    if (includeProperty[i])
    3
    addColumn(columnNames[i]);
    3
    addColumn(columnNames[i]);
    Preondition Violations
    Unmatched statement addColumn(columnNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
                                                                                                                                                      
    16
    values[i] = types[i].hydrate(rs, getPropertyAliases("", i), session, null);
    Preondition Violations
    Unmatched statement values[i]=types[i].hydrate(rs,getPropertyAliases("",i),session,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    values[i] = types[i].hydrate(rs, getPropertyAliases("", i), session, null);
    Precondition Violations (3)
    Row Violation
    1Type java.lang.String[] of variable columnNames does not match with type org.hibernate.type.Type[] of variable types
    2Unmatched statement addColumn(columnNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement values[i]=types[i].hydrate(rs,getPropertyAliases("",i),session,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted