if (result != null && !(result instanceof BigDecimal)) { if (result instanceof Number) { Number nbr = (Number) result; result = new BigDecimal(nbr.doubleValue()); } else { result = new BigDecimal(result.toString()); } }
if (result != null && !(result instanceof Double)) { if (result instanceof Number) { Number nbr = (Number) result; result = new Double(nbr.doubleValue()); } else { result = new Double(result.toString()); } }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/ResultSetReader.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/ResultSetReader.java
Method name: Object readNumeric(int) Method name: Object readFloat(int)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (result != null && !(result instanceof BigDecimal)) {
1
if (result != null && !(result instanceof Double)) {
2
         if (result instanceof Number) {
2
         if (result instanceof Number) {
3
            Number nbr = (Number) result;
3
            Number nbr = (Number) result;
4
            result = new BigDecimal(nbr.doubleValue());
4
            result = new Double(nbr.doubleValue());
5
         } else {
5
         } else {
6
            result = new BigDecimal(result.toString());
6
            result = new Double(result.toString());
7
         }
7
         }
8
      }
8
      }
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 declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (result != null && !(result instanceof BigDecimal))
    2
    if (result != null && !(result instanceof BigDecimal))
    2
    if (result != null && !(result instanceof Double))
    Differences
    Expression1Expression2Difference
    java.math.BigDecimaljava.lang.DoubleSUBCLASS_TYPE_MISMATCH
    2
    if (result != null && !(result instanceof Double))
    3
    if (result instanceof Number)
    3
    if (result instanceof Number)
    4
    Number nbr = (Number)result;
    4
    Number nbr = (Number)result;
    5
    result = new BigDecimal(nbr.doubleValue());
    5
    result = new BigDecimal(nbr.doubleValue());
    5
    result = new Double(nbr.doubleValue());
    Differences
    Expression1Expression2Difference
    java.math.BigDecimaljava.lang.DoubleSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new BigDecimal(nbr.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Double(nbr.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    result = new Double(nbr.doubleValue());
    else
    else
    6
    result = new BigDecimal(result.toString());
    6
    result = new BigDecimal(result.toString());
    6
    result = new Double(result.toString());
    Differences
    Expression1Expression2Difference
    java.math.BigDecimaljava.lang.DoubleSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new BigDecimal(result.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Double(result.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    result = new Double(result.toString());
    Precondition Violations (4)
    Row Violation
    1Expression new BigDecimal(nbr.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new Double(nbr.doubleValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new BigDecimal(result.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new Double(result.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted