if (value.equals("<null>") || value.equals(""))
return null;
// Do the conversion into the object in a safe manner
try {
Object obj = new Byte(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 Long(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/DataTypeByte.java
|
|
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeLong.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 | Object obj = new Byte(value);↵ | | 5 | Object obj = new Long(value);↵
|
6 | return obj;↵ | | 6 | return obj;↵
|
7 | }↵ | | 7 | }↵
|
8 | catch (Exception e) {↵ | | 8 | catch (Exception e) {↵
|
9 | messageBuffer.append(e.toString()+"\n");↵ | | 9 | messageBuffer.append(e.toString()+"\n");↵
|
10 | //?? do we need the message also, or is it automatically part of the toString()?↵ | | 10 | //?? do we need the message also, or is it automatically part of the toString()?↵
|
11 | //messageBuffer.append(e.getMessage());↵ | | 11 | //messageBuffer.append(e.getMessage());↵
|
12 | return null;↵ | | 12 | return null;↵
|
13 | } | | 13 | }
|
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 | 5 |
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) | 1.4 |
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 Byte(value); | | 4 | Object obj = new Long(value); |
5 | | | 5 | |
Precondition Violations (3)
Row |
Violation |
1 | Expression new Byte(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression new Long(value) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
3 | Not all possible execution flows end in a return statement |