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: 8 | Number of AST nodes: 8 | |||
1 | if (value.equals("<null>") || value.equals(""))↵ | 1 | if (value.equals("<null>") || value.equals(""))↵ | |
2 | return null;↵ | 2 | return null;↵ | |
3 | // Do the conversion into the object in a safe manner↵ | 3 | // Do the conversion into the object in a safe manner↵ | |
4 | try↵ | 4 | try↵ | |
5 | {↵ | 5 | {↵ | |
6 | Double obj;↵ | 6 | Float obj;↵ | |
7 | if(useJavaDefaultFormat)↵ | 7 | if(useJavaDefaultFormat)↵ | |
8 | {↵ | 8 | {↵ | |
9 | obj = new Double(value);↵ | 9 | obj = new Float(value);↵ | |
10 | }↵ | 10 | }↵ | |
11 | else↵ | 11 | else↵ | |
12 | {↵ | 12 | {↵ | |
13 | obj = new Double("" + _numberFormat.parse(value));↵ | 13 | obj = new Float("" + _numberFormat.parse(value));↵ | |
14 | }↵ | 14 | }↵ | |
15 | return obj;↵ | 15 | return obj;↵ | |
16 | }↵ | 16 | }↵ | |
17 | catch (Exception e)↵ | 17 | catch (Exception e)↵ | |
18 | {↵ | 18 | {↵ | |
19 | messageBuffer.append(e.toString() + "\n");↵ | 19 | messageBuffer.append(e.toString() + "\n");↵ | |
20 | //?? do we need the message also, or is it automatically part of the toString()?↵ | 20 | //?? do we need the message also, or is it automatically part of the toString()?↵ | |
21 | //messageBuffer.append(e.getMessage());↵ | 21 | //messageBuffer.append(e.getMessage());↵ | |
22 | return null;↵ | 22 | return null;↵ | |
23 | } | 23 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 22 |
Number of mapped statements | 8 |
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.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (value.equals("<null>") || value.equals("")) | 1 | if (value.equals("<null>") || value.equals("")) | ||||||||||||||||
2 | return null; | 2 | return null; | ||||||||||||||||
3 | try | 3 | try | ||||||||||||||||
4 | Double obj; |
| 4 | Float obj; | |||||||||||||||
5 | if (useJavaDefaultFormat) | 5 | if (useJavaDefaultFormat) | ||||||||||||||||
6 | obj = new Double(value); |
| 6 | obj = new Float(value); | |||||||||||||||
else | else | ||||||||||||||||||
7 | obj = new Double("" + _numberFormat.parse(value)); |
| 7 | obj = new Float("" + _numberFormat.parse(value)); | |||||||||||||||
8 | return obj; |
| 8 | return obj; |
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 |
5 | Not all possible execution flows end in a return statement |