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 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 18 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 13.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 3 | try |
4 | | | 4 | |
5 | if (useJavaDefaultFormat) | | 5 | if (useJavaDefaultFormat) |
6 | | | 6 | |
| | | | |
7 | obj = new Double("" + _numberFormat.parse(value)); | | 7 | obj = new Float("" + _numberFormat.parse(value)); |
8 | | | 8 | |
Precondition Violations (4)
Row |
Violation |
1 | Expression new Double(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression new Float(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
3 | 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 |
4 | 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 |