for ( int i = 0; i < exceptions.length; i++ ) { if ( SQLException.class.isAssignableFrom( exceptions[i] ) ) { return true; } }
for ( int i = 0; i < dirtyProperties.length; i++ ) { if ( propertyVersionability[ dirtyProperties[i] ] ) { return true; } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/test/java/org/hibernate/dialect/Mocks.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/Versioning.java
Method name: boolean canThrowSQLException(Method) Method name: boolean isVersionIncrementRequired(int[], boolean, boolean[])
Number of AST nodes: 3 Number of AST nodes: 3
1
for ( int i = 0; i < exceptions.length; i++ ) {
1
for ( int i = 0; i < dirtyProperties.length; i++ ) {
2
			if ( SQLException.class.isAssignableFrom( exceptions[i] ) ) {
2
			if ( propertyVersionability[ dirtyProperties[i] ] ) {
3
				return true;
3
				return true;
4
			}
4
			}
5
		}
5
		}
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.2
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < exceptions.length; i++)
    2
    for (int i = 0; i < exceptions.length; i++)
    3
    for (int i = 0; i < dirtyProperties.length; i++)
    Differences
    Expression1Expression2Difference
    exceptionsdirtyPropertiesVARIABLE_NAME_MISMATCH
    java.lang.Class[]int[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable exceptions does not match with type int[] of variable dirtyProperties
    • Make classes java.lang.Class[] and int[] extend a common superclass
    3
    for (int i = 0; i < dirtyProperties.length; i++)
    3
    if (SQLException.class.isAssignableFrom(exceptions[i]))
    3
    if (SQLException.class.isAssignableFrom(exceptions[i]))
    4
    if (propertyVersionability[dirtyProperties[i]])
    Differences
    Expression1Expression2Difference
    SQLException.class.isAssignableFrom(exceptions[i])propertyVersionability[dirtyProperties[i]]TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression SQLException.class.isAssignableFrom(exceptions[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression propertyVersionability[dirtyProperties[i]] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (propertyVersionability[dirtyProperties[i]])
    4
    return true;
    5
    return true;
    Precondition Violations (3)
    Row Violation
    1Type java.lang.Class[] of variable exceptions does not match with type int[] of variable dirtyProperties
    2Expression SQLException.class.isAssignableFrom(exceptions[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression propertyVersionability[dirtyProperties[i]] cannot be parameterized, because it has dependencies to/from statements that will be extracted