if (bdesc == null) return true; // can use an empty blob for editing if (bdesc.getWholeBlobRead()) return true; // the whole blob has been previously read in // data was not fully read in before, so try to do that now try { System.out.println("reading bytes from BLOB"); byte[] data = bdesc.getBlob().getBytes(1, (int)bdesc.getBlob().length()); // read succeeded, so reset the BlobDescriptor to match bdesc.setBlobRead(true); bdesc.setData(data); bdesc.setWholeBlobRead(true); bdesc.setUserSetBlobLimit(0); // we successfully read the whole thing return true; } catch (Exception ex) { bdesc.setBlobRead(false); bdesc.setWholeBlobRead(false); bdesc.setData(null); //?? What to do with this error? //?? error message = "Could not read the complete data. Error was: "+ex.getMessage()); return false; }
if (cdesc == null) return true; // can use an empty clob for editing if (cdesc.getWholeClobRead()) return true; // the whole clob has been previously read in // data was not fully read in before, so try to do that now try { String data = cdesc.getClob().getSubString(1, (int)cdesc.getClob().length()); // read succeeded, so reset the ClobDescriptor to match cdesc.setClobRead(true); cdesc.setData(data); cdesc.setWholeClobRead(true); cdesc.setUserSetClobLimit(0); // we successfully read the whole thing return true; } catch (Exception ex) { cdesc.setClobRead(false); cdesc.setWholeClobRead(false); cdesc.setData(null); //?? What to do with this error? //?? error message = "Could not read the complete data. Error was: "+ex.getMessage()); return false; }
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: boolean wholeBlobRead(BlobDescriptor) Method name: boolean wholeClobRead(ClobDescriptor)
Number of AST nodes: 12 Number of AST nodes: 11
1
if (bdesc == null)
1
if (cdesc == null)
2
			return true;	// can use an empty blob for editing
2
			return true;	// can use an empty clob for editing
3
		if (bdesc.getWholeBlobRead())
3
		if (cdesc.getWholeClobRead())
4
			return true;	// the whole blob has been previously read in
4
			return true;	// the whole clob has been previously read in
5
		// data was not fully read in before, so try to do that now
5
		// data was not fully read in before, so try to do that now
6
		try {
6
		try {
7
			System.out.println("reading bytes from BLOB");
7
			S
8
			byte[] data = bdesc.getBlob().getBytes(1, (int)bdesc.getBlob().length());
8
tring data = cdesc.getClob().getSubString(1, (int)cdesc.getClob().length());
9
			// read succeeded, so reset the BlobDescriptor to match
9
			// read succeeded, so reset the ClobDescriptor to match
10
			bdesc.setBlobRead(true);
10
			cdesc.setClobRead(true);
11
			bdesc.setData(data);
11
			cdesc.setData(data);
12
			bdesc.setWholeBlobRead(true);
12
			cdesc.setWholeClobRead(true);
13
			bdesc.setUserSetBlobLimit(0);
13
			cdesc.setUserSetClobLimit(0);
14
			// we successfully read the whole thing
14
			// we successfully read the whole thing
15
			 return true;
15
			 return true;
16
		}
16
		}
17
		catch (Exception ex) {
17
		catch (Exception ex) {
18
			bdesc.setBlobRead(false);
18
			cdesc.setClobRead(false);
19
			bdesc.setWholeBlobRead(false);
19
			cdesc.setWholeClobRead(false);
20
			bdesc.setData(null);
20
			cdesc.setData(null);
21
			//?? What to do with this error?
21
			//?? What to do with this error?
22
			//?? error message = "Could not read the complete data. Error was: "+ex.getMessage());
22
			//?? error message = "Could not read the complete data. Error was: "+ex.getMessage());
23
			return false;
23
			return false;
24
		}
24
		}
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)1.0
Clones locationClones are in different classes having the same super class
Number of node comparisons67
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment7
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)13.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (bdesc == null)
    1
    if (bdesc == null)
    1
    if (cdesc == null)
    Differences
    Expression1Expression2Difference
    bdesccdescVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptornet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    • Make classes net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor and net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor extend a common superclass
    1
    if (cdesc == null)
    2
    return true;
    2
    return true;
                                                                  
    3
    if (cdesc.getWholeClobRead())
                                  
    4
    return true;
    Preondition Violations
    Unmatched return true;
    4
    return true;
    3
    if (bdesc.getWholeBlobRead())
                                                                  
    4
    return true;
    4
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    5
    try
    5
    try
    5
    try
    Differences
    Expression1Expression2Difference
    setBlobReadsetClobReadMETHOD_INVOCATION_NAME_MISMATCH
    bdesccdescVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptornet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptorVARIABLE_TYPE_MISMATCH
    setWholeBlobReadsetWholeClobReadMETHOD_INVOCATION_NAME_MISMATCH
    bdesccdescVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptornet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptorVARIABLE_TYPE_MISMATCH
    bdesccdescVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptornet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression bdesc.setBlobRead(false) is a void method call, and thus it cannot be parameterized
    Expression cdesc.setClobRead(false) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    • Make classes net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor and net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor extend a common superclass
    Expression bdesc.setWholeBlobRead(false) is a void method call, and thus it cannot be parameterized
    Expression cdesc.setWholeClobRead(false) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    • Make classes net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor and net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor extend a common superclass
    Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    • Make classes net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor and net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor extend a common superclass
    5
    try
                                                                                                                                                              
    6
    String data = cdesc.getClob().getSubString(1, (int)cdesc.getClob().length());
    Preondition Violations
    Unmatched statement String data=cdesc.getClob().getSubString(1,(int)cdesc.getClob().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
    6
    String data = cdesc.getClob().getSubString(1, (int)cdesc.getClob().length());
    6
    System.out.println("reading bytes from BLOB");
                                                                                                      
                                                          
    7
    cdesc.setClobRead(true);
    Preondition Violations
    Unmatched statement cdesc.setClobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    cdesc.setClobRead(true);
    7
    byte[] data = bdesc.getBlob().getBytes(1, (int)bdesc.getBlob().length());
    7
    byte[] data = bdesc.getBlob().getBytes(1, (int)bdesc.getBlob().length());
    Preondition Violations
    Unmatched statement byte[] data=bdesc.getBlob().getBytes(1,(int)bdesc.getBlob().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
    bdesc.setBlobRead(true);
    8
    bdesc.setBlobRead(true);
    Preondition Violations
    Unmatched statement bdesc.setBlobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                          
    9
    bdesc.setData(data);
    9
    bdesc.setData(data);
    8
    cdesc.setData(data);
    Differences
    Expression1Expression2Difference
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    bdesccdescVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptornet.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type byte[] of variable data does not match with type java.lang.String of variable data
    • Make classes byte[] and java.lang.String extend a common superclass
    Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    • Make classes net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor and net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor extend a common superclass
    8
    cdesc.setData(data);
                                                                    
    9
    cdesc.setWholeClobRead(true);
    Preondition Violations
    Unmatched statement cdesc.setWholeClobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    cdesc.setWholeClobRead(true);
                                                                      
    10
    cdesc.setUserSetClobLimit(0);
    Preondition Violations
    Unmatched statement cdesc.setUserSetClobLimit(0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10
    cdesc.setUserSetClobLimit(0);
    10
    bdesc.setWholeBlobRead(true);
    10
    bdesc.setWholeBlobRead(true);
    Preondition Violations
    Unmatched statement bdesc.setWholeBlobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                      
    11
    bdesc.setUserSetBlobLimit(0);
    11
    bdesc.setUserSetBlobLimit(0);
    Preondition Violations
    Unmatched statement bdesc.setUserSetBlobLimit(0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                      
    12
    return true;
    11
    return true;
    Precondition Violations (21)
    Row Violation
    1Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    2Unmatched return true;
    3Unmatched return true;
    4Expression bdesc.setBlobRead(false) is a void method call, and thus it cannot be parameterized
    5Expression cdesc.setClobRead(false) is a void method call, and thus it cannot be parameterized
    6Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    7Expression bdesc.setWholeBlobRead(false) is a void method call, and thus it cannot be parameterized
    8Expression cdesc.setWholeClobRead(false) is a void method call, and thus it cannot be parameterized
    9Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    10Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    11Unmatched statement String data=cdesc.getClob().getSubString(1,(int)cdesc.getClob().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
    12Unmatched statement cdesc.setClobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    13Unmatched statement byte[] data=bdesc.getBlob().getBytes(1,(int)bdesc.getBlob().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
    14Unmatched statement bdesc.setBlobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    15Type byte[] of variable data does not match with type java.lang.String of variable data
    16Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BlobDescriptor of variable bdesc does not match with type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor of variable cdesc
    17Unmatched statement cdesc.setWholeClobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    18Unmatched statement cdesc.setUserSetClobLimit(0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    19Unmatched statement bdesc.setWholeBlobRead(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    20Unmatched statement bdesc.setUserSetBlobLimit(0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    21Not all possible execution flows end in a return statement