while ( criterionIterator.hasNext() ) { CriteriaImpl.CriterionEntry entry = ( CriteriaImpl.CriterionEntry ) criterionIterator.next(); String sqlString = entry.getCriterion().toSqlString( entry.getCriteria(), this ); condition.append( sqlString ); if ( criterionIterator.hasNext() ) { condition.append( " and " ); } }
while ( iter.hasNext() ) { Map.Entry e = (Map.Entry) iter.next(); buf.append( e.getKey() ).append( '=' ).append( e.getValue() ); if ( iter.hasNext() ) { buf.append( ", " ); } assignmentsAppended = true; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/sql/Update.java
Method name: String getWhereCondition() Method name: String toStatementString()
Number of AST nodes: 6 Number of AST nodes: 6
1
while ( criterionIterator.hasNext() ) {
1
while ( iter.hasNext() ) {
2
			CriteriaImpl.CriterionEntry entry = ( CriteriaImpl.CriterionEntry ) criterionIterator.next();
2
			Map.Entry e = (Map.Entry) iter.next();
3
			String sqlString = entry.getCriterion().toSqlString( entry.getCriteria(), this );
3
			
4
			condition.append( sqlString );
4
buf.append( e.getKey() ).append( '=' ).append( e.getValue() );
5
			if ( criterionIterator.hasNext() ) {
5
			if ( iter.hasNext() ) {
6
				condition.append( " and " );
6
				buf.append( ", " );
7
			}
7
			}
8
		
8
			assignmentsAppended = true;
9
}
9
		}
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 comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (criterionIterator.hasNext())
    3
    while (criterionIterator.hasNext())
    7
    while (iter.hasNext())
    Differences
    Expression1Expression2Difference
    criterionIteratoriterVARIABLE_NAME_MISMATCH
    7
    while (iter.hasNext())
    4
    CriteriaImpl.CriterionEntry entry = (CriteriaImpl.CriterionEntry)criterionIterator.next();
    4
    CriteriaImpl.CriterionEntry entry = (CriteriaImpl.CriterionEntry)criterionIterator.next();
    Preondition Violations
    Unmatched statement CriteriaImpl.CriterionEntry entry=(CriteriaImpl.CriterionEntry)criterionIterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                          
    5
    String sqlString = entry.getCriterion().toSqlString(entry.getCriteria(), this);
    5
    String sqlString = entry.getCriterion().toSqlString(entry.getCriteria(), this);
    Preondition Violations
    Unmatched statement String sqlString=entry.getCriterion().toSqlString(entry.getCriteria(),this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                  
    6
    condition.append(sqlString);
                                                                  
                                                                                
    8
    Map.Entry e = (Map.Entry)iter.next();
    Preondition Violations
    Unmatched statement Map.Entry e=(Map.Entry)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    Map.Entry e = (Map.Entry)iter.next();
                                                                                                                          
    9
    buf.append(e.getKey()).append('=').append(e.getValue());
    7
    if (criterionIterator.hasNext())
    7
    if (criterionIterator.hasNext())
    10
    if (iter.hasNext())
    Differences
    Expression1Expression2Difference
    criterionIteratoriterVARIABLE_NAME_MISMATCH
    10
    if (iter.hasNext())
    8
    condition.append(" and ");
    8
    condition.append(" and ");
    11
    buf.append(", ");
    Differences
    Expression1Expression2Difference
    " and "", "LITERAL_VALUE_MISMATCH
    conditionbufVARIABLE_NAME_MISMATCH
    11
    buf.append(", ");
                                                              
    12
    assignmentsAppended = true;
    Preondition Violations
    Unmatched statement assignmentsAppended=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    assignmentsAppended = true;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement CriteriaImpl.CriterionEntry entry=(CriteriaImpl.CriterionEntry)criterionIterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement String sqlString=entry.getCriterion().toSqlString(entry.getCriteria(),this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement Map.Entry e=(Map.Entry)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement assignmentsAppended=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted