File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/BlobType.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/ClobType.java | |||
Method name: void set(PreparedStatement, Object, int, SessionImplementor)
|
Method name: void set(PreparedStatement, Object, int, SessionImplementor)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | if (value instanceof SerializableBlob) {↵ | 1 | if (value instanceof SerializableClob) {↵ | |
2 | value = ( (SerializableBlob) value ).getWrappedBlob();↵ | 2 | value = ( (SerializableClob) value ).getWrappedClob();↵ | |
3 | }↵ | 3 | }↵ | |
4 | ↵ | 4 | ↵ | |
5 | final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob() && ↵ | 5 | final boolean useReader = session.getFactory().getDialect().useInputStreamToInsertBlob() && ↵ | |
6 | (value instanceof BlobImpl);↵ | 6 | (value instanceof ClobImpl);↵ | |
7 | ↵ | 7 | ↵ | |
8 | if ( useInputStream ) {↵ | 8 | if ( useReader ) {↵ | |
9 | BlobImpl blob = (BlobImpl) value;↵ | 9 | ClobImpl clob = (ClobImpl) value;↵ | |
10 | st.setBinaryStream( index, blob.getBinaryStream(), (int) blob.length() );↵ | 10 | st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() );↵ | |
11 | }↵ | 11 | }↵ | |
12 | else {↵ | 12 | else {↵ | |
13 | st.setBlob(index, (Blob) value);↵ | 13 | st.setClob(index, (Clob) value);↵ | |
14 | } | 14 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 21 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob() && (value instanceof BlobImpl); |
| 5 | final boolean useReader = session.getFactory().getDialect().useInputStreamToInsertBlob() && (value instanceof ClobImpl); | ||||||||||||||
6 | if (useInputStream) |
| 6 | if (useReader) | ||||||||||||||
| 7 | ClobImpl clob = (ClobImpl)value; | ||||||||||||||||
7 | BlobImpl blob = (BlobImpl)value; | | ||||||||||||||||
| 8 | st.setCharacterStream(index, clob.getCharacterStream(), (int)clob.length()); | ||||||||||||||||
8 | st.setBinaryStream(index, blob.getBinaryStream(), (int)blob.length()); | | ||||||||||||||||
else | else | |||||||||||||||||
9 | st.setBlob(index, (Blob)value); |
| 9 | st.setClob(index, (Clob)value); |
Row | Violation |
---|---|
1 | Type boolean of variable value instanceof BlobImpl does not match with type boolean of variable value instanceof ClobImpl |
2 | Expression st.setBlob(index,(Blob)value) is a void method call, and thus it cannot be parameterized |
3 | Expression st.setClob(index,(Clob)value) is a void method call, and thus it cannot be parameterized |