try { if ( value == null ) { if ( IS_VALUE_TRACING_ENABLED ) { log().trace( "binding null to parameter: " + index ); } st.setNull( index, sqlType() ); } else { if ( IS_VALUE_TRACING_ENABLED ) { log().trace( "binding '" + toString( value ) + "' to parameter: " + index ); } set( st, value, index ); } } catch ( RuntimeException re ) { log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + re.getMessage() ); throw re; } catch ( SQLException se ) { log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + se.getMessage() ); throw se; }
try { Object value = get(rs, name); if ( value == null || rs.wasNull() ) { if ( IS_VALUE_TRACING_ENABLED ) { log().trace( "returning null as column: " + name ); } return null; } else { if ( IS_VALUE_TRACING_ENABLED ) { log().trace( "returning '" + toString( value ) + "' as column: " + name ); } return value; } } catch ( RuntimeException re ) { log().info( "could not read column value from result set: " + name + "; " + re.getMessage() ); throw re; } catch ( SQLException se ) { log().info( "could not read column value from result set: " + name + "; " + se.getMessage() ); throw se; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/NullableType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/NullableType.java
Method name: void nullSafeSet(PreparedStatement, Object, int) Method name: Object nullSafeGet(ResultSet, String)
Number of AST nodes: 8 Number of AST nodes: 9
1
try {
1
try {
2
			
2
			Object value = get(rs, name);
3
if ( value == null ) {
3
			if ( value == null || rs.wasNull() ) {
4
				if ( IS_VALUE_TRACING_ENABLED ) {
4
				if ( IS_VALUE_TRACING_ENABLED ) {
5
					log().trace( "binding null to parameter: " + index );
5
					log().trace( "returning null as column: " + name );
6
				}
6
				}
7
				st.setNull( index, sqlType() );
7
				return null;
8
			}
8
			}
9
			else {
9
			else {
10
				if ( IS_VALUE_TRACING_ENABLED ) {
10
				if ( IS_VALUE_TRACING_ENABLED ) {
11
					log().trace( "binding '" + toString( value ) + "' to parameter: " + index );
11
					log().trace( "returning '" + toString( value ) + "' as column: " + name );
12
				}
12
				}
13
				set( st, value, index );
13
				return value;
14
			}
14
			}
15
		}
15
		}
16
		catch ( RuntimeException re ) {
16
		catch ( RuntimeException re ) {
17
			log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
17
			log().info( "could not read column value from result set: " + name + "; " + re.getMessage() );
18
			throw re;
18
			throw re;
19
		}
19
		}
20
		catch ( SQLException se ) {
20
		catch ( SQLException se ) {
21
			log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
21
			log().info( "could not read column value from result set: " + name + "; " + se.getMessage() );
22
			throw se;
22
			throw se;
23
		}
23
		}
Summary
Number of common nesting structure subtrees2
Number of refactorable cases2
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons11
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements1
    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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (IS_VALUE_TRACING_ENABLED)
    4
    if (IS_VALUE_TRACING_ENABLED)
    4
    log().trace("binding null to parameter: " + index);
                                                                                                                
                                                                                                            
    5
    log().trace("returning null as column: " + name);
    Precondition Violations (0)
    Row Violation
  2. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (IS_VALUE_TRACING_ENABLED)
    4
    if (IS_VALUE_TRACING_ENABLED)
    7
    log().trace("binding '" + toString(value) + "' to parameter: " + index);
    7
    log().trace("binding '" + toString(value) + "' to parameter: " + index);
    5
    log().trace("returning null as column: " + name);
    Differences
    Expression1Expression2Difference
    "binding '""returning null as column: "LITERAL_VALUE_MISMATCH
    toString(value)nameTYPE_COMPATIBLE_REPLACEMENT
    "binding '" + toString(value) + "' to parameter: "+ index"returning null as column: " + nameINFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    5
    log().trace("returning null as column: " + name);
    Precondition Violations (0)
    Row Violation