int len = (int)blob.length(); if (len > 0) { int charsToRead = len; if (! _readCompleteBlobs) { charsToRead = _readBlobsSize; } if (charsToRead > len) { charsToRead = len; } blobData = blob.getBytes(1, charsToRead); }
int len = (int)clob.length(); if (len > 0) { int charsToRead = len; if ( ! _readCompleteClobs) { charsToRead = _readClobsSize; } if (charsToRead > len) { charsToRead = len; } clobData = clob.getSubString(1, charsToRead); }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBlob.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeClob.java
Method name: Object staticReadResultSet(ResultSet, int) Method name: Object staticReadResultSet(ResultSet, int)
Number of AST nodes: 8 Number of AST nodes: 8
1
int len = (int)blob.length();
1
int len = (int)clob.length();
2
				if (len > 0)
2
				if (len > 0)
3
				{
3
				{
4
					int charsToRead = len;
4
					int charsToRead = len;
5
					if (! _readCompleteBlobs)
5
					if ( ! _readCompleteClobs)
6
					{
6
					{
7
						charsToRead = _readBlobsSize;
7
						charsToRead = _readClobsSize;
8
					}
8
					}
9
					if (charsToRead > len)
9
					if (charsToRead > len)
10
					{
10
					{
11
						charsToRead = len;
11
						charsToRead = len;
12
					}
12
					}
13
					blobData = blob.getBytes(1, charsToRead);
13
					clobData = clob.getSubString(1, charsToRead);
14
				}
14
				}
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    int len = (int)blob.length();
    7
    int len = (int)blob.length();
    7
    int len = (int)clob.length();
    Differences
    Expression1Expression2Difference
    blobclobVARIABLE_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.Blob of variable blob does not match with type java.sql.Clob of variable clob
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    7
    int len = (int)clob.length();
    8
    if (len > 0)
    8
    if (len > 0)
    9
    int charsToRead = len;
    9
    int charsToRead = len;
    10
    if (!_readCompleteBlobs)
    10
    if (!_readCompleteBlobs)
    10
    if (!_readCompleteClobs)
    Differences
    Expression1Expression2Difference
    _readCompleteBlobs_readCompleteClobsVARIABLE_NAME_MISMATCH
    10
    if (!_readCompleteClobs)
    11
    charsToRead = _readBlobsSize;
    11
    charsToRead = _readBlobsSize;
    11
    charsToRead = _readClobsSize;
    Differences
    Expression1Expression2Difference
    _readBlobsSize_readClobsSizeVARIABLE_NAME_MISMATCH
    11
    charsToRead = _readClobsSize;
    12
    if (charsToRead > len)
    12
    if (charsToRead > len)
    13
    charsToRead = len;
    13
    charsToRead = len;
                                                                                                
    14
    clobData = clob.getSubString(1, charsToRead);
    Preondition Violations
    Unmatched statement clobData=clob.getSubString(1,charsToRead); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement clobData=clob.getSubString(1,charsToRead); 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
    14
    clobData = clob.getSubString(1, charsToRead);
    14
    blobData = blob.getBytes(1, charsToRead);
    14
    blobData = blob.getBytes(1, charsToRead);
    Preondition Violations
    Unmatched statement blobData=blob.getBytes(1,charsToRead); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement blobData=blob.getBytes(1,charsToRead); 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
                                                                                        
    Precondition Violations (5)
    Row Violation
    1Type java.sql.Blob of variable blob does not match with type java.sql.Clob of variable clob
    2Unmatched statement clobData=clob.getSubString(1,charsToRead); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement clobData=clob.getSubString(1,charsToRead); 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
    4Unmatched statement blobData=blob.getBytes(1,charsToRead); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement blobData=blob.getBytes(1,charsToRead); 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