if ( !rs.next() ) { throw new IdentifierGenerationException( "the inserted row could not be located by the unique key: " + uniqueKeyPropertyName ); }
if (indexContainsFormula) { throw new AssertionFailure("cannot use a formula-based index in the where condition"); } getIndexType().nullSafeSet( st, incrementIndexByBase(index), i, session ); return i + indexColumnAliases.length;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/SelectGenerator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
Method name: Serializable getResult(SessionImplementor, ResultSet, Object) Method name: int writeIndexToWhere(PreparedStatement, Object, int, SessionImplementor)
Number of AST nodes: 2 Number of AST nodes: 4
1
if ( !rs.next() ) {
1
if (indexContainsFormula) {
2
				throw new IdentifierGenerationException(
2
			throw new AssertionFailure("cannot use a formula-based index in the where condition
3
						"the inserted row could not be located by the unique key: " +
4
						uniqueKeyPropertyName
5
				);
6
			}
3
");
4
		}
5
		getIndexType().nullSafeSet( st, incrementIndexByBase(index), i, session );
6
		return i + indexColumnAliases.length;
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.1
Clones locationClones are in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (!rs.next())
    1
    if (!rs.next())
    1
    if (indexContainsFormula)
    Differences
    Expression1Expression2Difference
    !rs.next()indexContainsFormulaTYPE_COMPATIBLE_REPLACEMENT
    1
    if (indexContainsFormula)
    2
    throw new IdentifierGenerationException("the inserted row could not be located by the unique key: " + uniqueKeyPropertyName);
    2
    throw new IdentifierGenerationException("the inserted row could not be located by the unique key: " + uniqueKeyPropertyName);
    2
    throw new AssertionFailure("cannot use a formula-based index in the where condition");
    Differences
    Expression1Expression2Difference
    org.hibernate.id.IdentifierGenerationExceptionorg.hibernate.AssertionFailureSUBCLASS_TYPE_MISMATCH
    "the inserted row could not be located by the unique key: " + uniqueKeyPropertyName"cannot use a formula-based index in the where condition"TYPE_COMPATIBLE_REPLACEMENT
    2
    throw new AssertionFailure("cannot use a formula-based index in the where condition");
                                                                                                                                                    
    3
    getIndexType().nullSafeSet(st, incrementIndexByBase(index), i, session);
                                                                                    
    4
    return i + indexColumnAliases.length;
    Preondition Violations
    Unmatched return i + indexColumnAliases.length;
    4
    return i + indexColumnAliases.length;
    Precondition Violations (2)
    Row Violation
    1Unmatched return i + indexColumnAliases.length;
    2The refactoring of the clones is infeasible, because classes org.hibernate.id.SelectGenerator.SelectGeneratorDelegate and org.hibernate.persister.collection.AbstractCollectionPersister do not have a common superclass