if (lo>maxLo) { int hival = ( (Integer) doWorkInNewTransaction(session) ).intValue(); lo = (hival == 0) ? 1 : 0; hi = hival * (maxLo+1); log.debug("new hi value: " + hival); }
if (lo>maxLo) { long hival = ( (Number) super.generate(session, obj) ).longValue(); lo = (hival == 0) ? 1 : 0; hi = hival * (maxLo+1); log.debug("new hi value: " + hival); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/TableHiLoGenerator.java
Method name: Serializable generate(SessionImplementor, Object) Method name: Serializable generate(SessionImplementor, Object)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (lo>maxLo) {
1
if (lo>maxLo) {
2
			int hival = ( (Integer) doWorkInNewTransaction(session) ).intValue();
2
			long hival = ( (Number) super.generate(session, obj) ).longValue();
3
			lo = (hival == 0) ? 1 : 0;
3
			lo = (hival == 0) ? 1 : 0;
4
			hi = hival * (maxLo+1);
4
			hi = hival * (maxLo+1);
5
			log.debug("new hi value: " + hival);
5
			log.debug("new hi value: " + hival);
6
		}
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (lo > maxLo)
    6
    if (lo > maxLo)
                                                                                                                                    
    7
    long hival = ((Number)super.generate(session, obj)).longValue();
    Preondition Violations
    Unmatched statement long hival=((Number)super.generate(session,obj)).longValue(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7
    long hival = ((Number)super.generate(session, obj)).longValue();
    7
    int hival = ((Integer)doWorkInNewTransaction(session)).intValue();
    7
    int hival = ((Integer)doWorkInNewTransaction(session)).intValue();
    Preondition Violations
    Unmatched statement int hival=((Integer)doWorkInNewTransaction(session)).intValue(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                          
    8
    lo = (hival == 0) ? 1 : 0;
    8
    lo = (hival == 0) ? 1 : 0;
    8
    lo = (hival == 0) ? 1 : 0;
    Differences
    Expression1Expression2Difference
    intlongVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable hival does not match with type long of variable hival
    8
    lo = (hival == 0) ? 1 : 0;
                                                        
    9
    hi = hival * (maxLo + 1);
    Preondition Violations
    Unmatched statement hi=hival * (maxLo + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    hi = hival * (maxLo + 1);
    9
    hi = hival * (maxLo + 1);
    9
    hi = hival * (maxLo + 1);
    Preondition Violations
    Unmatched statement hi=hival * (maxLo + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                        
    10
    log.debug("new hi value: " + hival);
    10
    log.debug("new hi value: " + hival);
    10
    log.debug("new hi value: " + hival);
    Differences
    Expression1Expression2Difference
    intlongVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable hival does not match with type long of variable hival
    10
    log.debug("new hi value: " + hival);
    Precondition Violations (7)
    Row Violation
    1Unmatched statement long hival=((Number)super.generate(session,obj)).longValue(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched statement int hival=((Integer)doWorkInNewTransaction(session)).intValue(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Type int of variable hival does not match with type long of variable hival
    4Unmatched statement hi=hival * (maxLo + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement hi=hival * (maxLo + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Type int of variable hival does not match with type long of variable hival
    7The refactoring of the clones is infeasible, because classes org.hibernate.id.MultipleHiLoPerTableGenerator and org.hibernate.id.TableHiLoGenerator do not have a common superclass