try { Double obj; if(useJavaDefaultFormat) { obj = new Double(value); } else { obj = new Double("" + _numberFormat.parse(value)); } return obj; } catch (Exception e) { messageBuffer.append(e.toString() + "\n"); //?? do we need the message also, or is it automatically part of the toString()? //messageBuffer.append(e.getMessage()); return null; }
try { Float obj; if(useJavaDefaultFormat) { obj = new Float(value); } else { obj = new Float("" + _numberFormat.parse(value)); } return obj; } catch (Exception e) { messageBuffer.append(e.toString() + "\n"); //?? do we need the message also, or is it automatically part of the toString()? //messageBuffer.append(e.getMessage()); return null; }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeDouble.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeFloat.java
Method name: Object validateAndConvert(String, Object, StringBuffer) Method name: Object validateAndConvert(String, Object, StringBuffer)
Number of AST nodes: 6 Number of AST nodes: 6
1
try
1
try
2
      {
2
      {
3
         Double obj;
3
         Float obj;
4
         if(useJavaDefaultFormat)
4
         if(useJavaDefaultFormat)
5
         {
5
         {
6
            obj = new Double(value);
6
            obj = new Float(value);
7
         }
7
         }
8
         else
8
         else
9
         {
9
         {
10
            obj = new Double("" + _numberFormat.parse(value));
10
            obj = new Float("" + _numberFormat.parse(value));
11
         }
11
         }
12
         return obj;
12
         return obj;
13
      }
13
      }
14
      catch (Exception e)
14
      catch (Exception e)
15
      {
15
      {
16
         messageBuffer.append(e.toString() + "\n");
16
         messageBuffer.append(e.toString() + "\n");
17
         //?? do we need the message also, or is it automatically part of the toString()?
17
         //?? do we need the message also, or is it automatically part of the toString()?
18
         //messageBuffer.append(e.getMessage());
18
         //messageBuffer.append(e.getMessage());
19
         return null;
19
         return null;
20
      }
20
      }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes having the same super class
Number of node comparisons18
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)13.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    try
    3
    try
    4
    Double obj;
    4
    Double obj;
    4
    Float obj;
    Differences
    Expression1Expression2Difference
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    4
    Float obj;
    5
    if (useJavaDefaultFormat)
    5
    if (useJavaDefaultFormat)
    6
    obj = new Double(value);
    6
    obj = new Double(value);
    6
    obj = new Float(value);
    Differences
    Expression1Expression2Difference
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new Double(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression new Float(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    6
    obj = new Float(value);
    else
    else
    7
    obj = new Double("" + _numberFormat.parse(value));
    7
    obj = new Double("" + _numberFormat.parse(value));
    7
    obj = new Float("" + _numberFormat.parse(value));
    Differences
    Expression1Expression2Difference
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new Double("" + _numberFormat.parse(value)) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression new Float("" + _numberFormat.parse(value)) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    7
    obj = new Float("" + _numberFormat.parse(value));
    8
    return obj;
    8
    return obj;
    8
    return obj;
    Differences
    Expression1Expression2Difference
    java.lang.Doublejava.lang.FloatSUBCLASS_TYPE_MISMATCH
    8
    return obj;
    Precondition Violations (4)
    Row Violation
    1Expression new Double(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression new Float(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Expression new Double("" + _numberFormat.parse(value)) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4Expression new Float("" + _numberFormat.parse(value)) is a method call throwing exception(s) that should be caught by a try block that will be extracted