for ( int i = 0; i < row.length; i++ ) { if ( includeInSelect[i] ) { result[j++] = row[i]; } }
for ( int j = 0; j < span; j++ ) { // Now update only the tables with dirty properties (and the table with the version number) if ( tableUpdateNeeded[j] ) { updateOrInsert( id, fields, oldFields, j == 0 ? rowId : null, propsToUpdate, j, oldVersion, object, updateStrings[j], session ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/hql/QueryLoader.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
Method name: Object[] toResultRow(Object[]) Method name: void update(Serializable, Object[], int[], boolean, Object[], Object, Object, Object, SessionImplementor)
Number of AST nodes: 3 Number of AST nodes: 3
1
for ( int i = 0; i < row.length; i++ ) {
1
for ( int j = 0; j < span; j++ ) {
2
				if ( includeInSelect[i] ) {
2
			
3
					result[j++] = row[i];
4
				}
5
	
3
// Now update only the tables with dirty properties (and the table with the version number)
4
			if ( tableUpdateNeeded[j] ) {
5
				updateOrInsert(
6
						id,
7
						fields,
8
						oldFields,
9
						j == 0 ? rowId : null,
10
						propsToUpdate,
11
						j,
12
						oldVersion,
13
						object,
14
						updateStrings[j],
15
						session
16
					);
17
			}
6
		}
18
		}
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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 0; i < row.length; i++)
    5
    for (int i = 0; i < row.length; i++)
    12
    for (int j = 0; j < span; j++)
    Differences
    Expression1Expression2Difference
    ijVARIABLE_NAME_MISMATCH
    ijVARIABLE_NAME_MISMATCH
    row.lengthspanTYPE_COMPATIBLE_REPLACEMENT
    ijVARIABLE_NAME_MISMATCH
    12
    for (int j = 0; j < span; j++)
    6
    if (includeInSelect[i])
    6
    if (includeInSelect[i])
    13
    if (tableUpdateNeeded[j])
    Differences
    Expression1Expression2Difference
    includeInSelecttableUpdateNeededVARIABLE_NAME_MISMATCH
    ijVARIABLE_NAME_MISMATCH
    13
    if (tableUpdateNeeded[j])
    7
    result[j++] = row[i];
    7
    result[j++] = row[i];
    Preondition Violations
    Unmatched statement result[j++]=row[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
                                                                                                                                                                                                                                                      
    14
    updateOrInsert(id, fields, oldFields, j == 0 ? rowId : null, propsToUpdate, j, oldVersion, object, updateStrings[j], session);
    Preondition Violations
    Unmatched statement updateOrInsert(id,fields,oldFields,j == 0 ? rowId : null,propsToUpdate,j,oldVersion,object,updateStrings[j],session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    updateOrInsert(id, fields, oldFields, j == 0 ? rowId : null, propsToUpdate, j, oldVersion, object, updateStrings[j], session);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement result[j++]=row[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement updateOrInsert(id,fields,oldFields,j == 0 ? rowId : null,propsToUpdate,j,oldVersion,object,updateStrings[j],session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted