if (value.equals("<null>") || value.equals("")) return null;
// Do the conversion into the object in a safe manner
try
{
Object obj = Boolean.valueOf(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;
}
if (value.equals("<null>") || value.equals(""))
return null;
// Do the conversion into the object in a safe manner
try {
Object obj = new Short(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/DataTypeBoolean.java
|
|
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeShort.java
|
Method name: Object validateAndConvert(String, Object, StringBuffer)
|
|
Method name: Object validateAndConvert(String, Object, StringBuffer)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
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 | Object obj = Boolean.valueOf(value);↵ | | 6 | Object obj = new Short(value);↵
|
7 | return obj;↵ | | 7 | return obj;↵
|
8 | }↵ | | 8 | }↵
|
9 | catch (Exception e)↵ | | 9 | catch (Exception e)↵
|
10 | {↵ | | 10 | {↵
|
11 | messageBuffer.append(e.toString() + "\n");↵ | | 11 | messageBuffer.append(e.toString()+"\n");↵
|
12 | // ?? do we need the message also, or is it automatically part of the toString()?↵ | | 12 | //?? do we need the message also, or is it automatically part of the toString()?↵
|
13 | // messageBuffer.append(e.getMessage());↵ | | 13 | //messageBuffer.append(e.getMessage());↵
|
14 | return null;↵ | | 14 | return null;↵
|
15 | } | | 15 | }
|
See real code fragment |
|
See real code fragment |
Summary
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 15 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (value.equals("<null>") || value.equals("")) | | 1 | if (value.equals("<null>") || value.equals("")) |
2 | | | 2 | |
3 | try | | 3 | try |
| | | 4 | Object obj = new Short(value); |
4 | Object obj = Boolean.valueOf(value); | | | |
5 | | | 5 | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement Object obj=new Short(value); 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 |
2 | Not all possible execution flows end in a return statement |