if ( useInputStream ) { BlobImpl blob = (BlobImpl) value; st.setBinaryStream( index, blob.getBinaryStream(), (int) blob.length() ); } else { st.setBlob(index, (Blob) value); }
if ( useReader ) { ClobImpl clob = (ClobImpl) value; st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() ); } else { st.setClob(index, (Clob) value); }
Clone fragments detected by clone detection tool
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: 4 Number of AST nodes: 4
1
if ( useInputStream ) {
1
if ( useReader ) {
2
				BlobImpl blob = (BlobImpl) value;
2
				ClobImpl clob = (ClobImpl) value;
3
				st.setBinaryStream( index, blob.getBinaryStream(), (int) blob.length() );
3
				st.setCharacterStream( index, clob.getCharacterStream(), (int) clob.length() );
4
			}
4
			}
5
			else {
5
			else {
6
				st.setBlob(index, (Blob) value);
6
				st.setClob(index, (Clob) value);
7
			}
7
			}
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 having the same super class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (useInputStream)
    6
    if (useInputStream)
    6
    if (useReader)
    Differences
    Expression1Expression2Difference
    useInputStreamuseReaderVARIABLE_NAME_MISMATCH
    6
    if (useReader)
                                                                      
    7
    ClobImpl clob = (ClobImpl)value;
    7
    BlobImpl blob = (BlobImpl)value;
                                                                      
                                                                                                                                                              
    8
    st.setCharacterStream(index, clob.getCharacterStream(), (int)clob.length());
    Preondition Violations
    Unmatched statement st.setCharacterStream(index,clob.getCharacterStream(),(int)clob.length()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement st.setCharacterStream(index,clob.getCharacterStream(),(int)clob.length()); 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
    st.setCharacterStream(index, clob.getCharacterStream(), (int)clob.length());
    8
    st.setBinaryStream(index, blob.getBinaryStream(), (int)blob.length());
    8
    st.setBinaryStream(index, blob.getBinaryStream(), (int)blob.length());
    Preondition Violations
    Unmatched statement st.setBinaryStream(index,blob.getBinaryStream(),(int)blob.length()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement st.setBinaryStream(index,blob.getBinaryStream(),(int)blob.length()); 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
                                                                                                                                                  
    else
    else
    9
    st.setBlob(index, (Blob)value);
    9
    st.setBlob(index, (Blob)value);
    9
    st.setClob(index, (Clob)value);
    Differences
    Expression1Expression2Difference
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    setBlobsetClobMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Type java.sql.Blob does not match with type java.sql.Clob
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    Expression st.setBlob(index,(Blob)value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression st.setClob(index,(Clob)value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression st.setBlob(index,(Blob)value) is a void method call, and thus it cannot be parameterized
    Expression st.setClob(index,(Clob)value) is a void method call, and thus it cannot be parameterized
    9
    st.setClob(index, (Clob)value);
    Precondition Violations (9)
    Row Violation
    1Unmatched statement st.setCharacterStream(index,clob.getCharacterStream(),(int)clob.length()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement st.setCharacterStream(index,clob.getCharacterStream(),(int)clob.length()); 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
    3Unmatched statement st.setBinaryStream(index,blob.getBinaryStream(),(int)blob.length()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement st.setBinaryStream(index,blob.getBinaryStream(),(int)blob.length()); 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
    5Type java.sql.Blob does not match with type java.sql.Clob
    6Expression st.setBlob(index,(Blob)value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    7Expression st.setClob(index,(Clob)value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8Expression st.setBlob(index,(Blob)value) is a void method call, and thus it cannot be parameterized
    9Expression st.setClob(index,(Clob)value) is a void method call, and thus it cannot be parameterized