try { if (needsReset) stream.reset(); } catch (IOException ioe) { throw new SQLException("could not reset reader"); } needsReset = true; return stream;
try { if (needsReset) reader.reset(); } catch (IOException ioe) { throw new SQLException("could not reset reader"); } needsReset = true; return reader;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/lob/BlobImpl.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/lob/ClobImpl.java
Method name: InputStream getBinaryStream() Method name: Reader getCharacterStream()
Number of AST nodes: 5 Number of AST nodes: 5
1
try {
1
try {
2
			if (needsReset) stream.reset();
2
			if (needsReset) reader.reset();
3
		}
3
		}
4
		catch (IOException ioe) {
4
		catch (IOException ioe) {
5
			throw new SQLException("could not reset reader");
5
			throw new SQLException("could not reset reader");
6
		}
6
		}
7
		needsReset = true;
7
		needsReset = true;
8
		return stream;
8
		return reader;
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 comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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
    1
    try
    1
    try
    2
    if (needsReset)
    2
    if (needsReset)
    3
    stream.reset();
    3
    stream.reset();
    3
    reader.reset();
    Differences
    Expression1Expression2Difference
    streamreaderVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.ReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.InputStream of variable stream does not match with type java.io.Reader of variable reader
    • Make classes java.io.InputStream and java.io.Reader extend a common superclass
    3
    reader.reset();
    4
    needsReset = true;
    4
    needsReset = true;
                                      
    5
    return reader;
    Preondition Violations
    Unmatched return reader;
    5
    return reader;
    5
    return stream;
    5
    return stream;
    Preondition Violations
    Unmatched return stream;
                                      
    Precondition Violations (3)
    Row Violation
    1Type java.io.InputStream of variable stream does not match with type java.io.Reader of variable reader
    2Unmatched return reader;
    3Unmatched return stream;