Object result = null; try { result = rs.getString(idx); if (result == null || "".equals(result)) { return NULL_VALUE_PATTERN; } } catch (Exception e) { s_log.error("Unexpected exception while attempting to read PostgreSQL XML column", e); } if (result == null) { result = i18n.CELL_ERROR_MSG; } return result;
String result = null; try { result = rs.getString(idx); if (rs.wasNull() || result == null) { return NULL_VALUE_PATTERN; } } catch (Exception e) { s_log.error("Unexpected exception while attempting to read " + "SYS.XMLType column", e); } if (result == null) { result = i18n.CELL_ERROR_MSG; } return result;
Clone fragments detected by clone detection tool
File path: /sql12/plugins/postgres/src/net/sourceforge/squirrel_sql/plugins/postgres/types/PostgreSqlXmlTypeDataTypeComponent.java File path: /sql12/plugins/db2/src/net/sourceforge/squirrel_sql/plugins/db2/types/DB2XmlTypeDataTypeComponent.java
Method name: Object readResultSet(ResultSet, int, boolean) Method name: Object readResultSet(ResultSet, int, boolean)
Number of AST nodes: 8 Number of AST nodes: 8
1
Object result = null;
1
String result = null;
2
		try
2
		try
3
		{
3
 {
4
			result = rs.getString(idx);
4
			result = rs.getString(idx);
5
			if (result == null || "".equals(result))
5
			if (r
6
			{
6
s.wasNull() || result == null) {
7
				return NULL_VALUE_PATTERN;
7
				return NULL_VALUE_PATTERN;
8
			} 
8
			}
9
		} catch (Exception e) {
9
		} catch (Exception e) {
10
			s_log.error("Unexpected exception while attempting to read PostgreSQL XML
10
			s_log.error("Unexpected exception while attempting to read "
11
 column", e);
11
					+ "SYS.XMLType column", e);
12
		}
12
		}
13
		if (result == null)
13
		if (result == null)
14
		{
14
 {
15
			result = i18n.CELL_ERROR_MSG;
15
			result = i18n.CELL_ERROR_MSG;
16
		}
16
		}
17
		return result;
17
		return result;
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)10.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                
    1
    String result = null;
    1
    Object result = null;
                                                
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    "Unexpected exception while attempting to read PostgreSQL XML column""Unexpected exception while attempting to read " + "SYS.XMLType column"TYPE_COMPATIBLE_REPLACEMENT
    2
    try
                                                            
    3
    result = rs.getString(idx);
    Preondition Violations
    Unmatched statement result=rs.getString(idx); 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
    3
    result = rs.getString(idx);
    3
    result = rs.getString(idx);
    3
    result = rs.getString(idx);
    Preondition Violations
    Unmatched statement result=rs.getString(idx); 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
                                                            
    4
    if (result == null || "".equals(result))
    4
    if (result == null || "".equals(result))
    4
    if (rs.wasNull() || result == null)
    Differences
    Expression1Expression2Difference
    result == nullrs.wasNull()INFIX_LEFT_OPERAND_MISMATCH
    "".equals(result)result == nullINFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression result == null || "".equals(result) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rs.wasNull() || result == null cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (rs.wasNull() || result == null)
    5
    return NULL_VALUE_PATTERN;
    5
    return NULL_VALUE_PATTERN;
    6
    if (result == null)
    6
    if (result == null)
    6
    if (result == null)
    Differences
    Expression1Expression2Difference
    java.lang.Objectjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable result does not match with type java.lang.String of variable result
    • Make classes java.lang.Object and java.lang.String extend a common superclass
    6
    if (result == null)
                                                                
    7
    result = i18n.CELL_ERROR_MSG;
    Preondition Violations
    Unmatched statement result=i18n.CELL_ERROR_MSG; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    result = i18n.CELL_ERROR_MSG;
    7
    result = i18n.CELL_ERROR_MSG;
    7
    result = i18n.CELL_ERROR_MSG;
    Preondition Violations
    Unmatched statement result=i18n.CELL_ERROR_MSG; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
                                      
    8
    return result;
    Preondition Violations
    Unmatched return result;
    8
    return result;
    8
    return result;
    8
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    Precondition Violations (10)
    Row Violation
    1Unmatched statement result=rs.getString(idx); 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
    2Unmatched statement result=rs.getString(idx); 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
    3Expression result == null || "".equals(result) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression rs.wasNull() || result == null cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.lang.Object of variable result does not match with type java.lang.String of variable result
    6Unmatched statement result=i18n.CELL_ERROR_MSG; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement result=i18n.CELL_ERROR_MSG; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched return result;
    9Unmatched return result;
    10Not all possible execution flows end in a return statement