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 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 2 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 11 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
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); |
| 5 | log().trace("returning null as column: " + name); |
Row | Violation |
---|---|
1 | Expression toString(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression "binding '" + toString(value) + "' to parameter: "+ index is a method call throwing exception(s) that should be caught by a try block that will be extracted |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 2 |
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); |
Row | Violation |
---|---|
1 | Type int of variable index does not match with type java.lang.String of variable name |