String code;
try {
code = (String) CURRENCY_GET_CODE.invoke(value, null);
}
catch (Exception e) {
throw new HibernateException("Could not get Currency code", e);
}
return ( (LiteralType) Hibernate.STRING ).objectToSQLString(code, dialect);
Object code;
try {
code = CURRENCY_GET_CODE.invoke(value, null);
}
catch (Exception e) {
throw new HibernateException("Could not get Currency code", e);
}
Hibernate.STRING.set(st, code, index);
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/CurrencyType.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/CurrencyType.java
|
Method name: String objectToSQLString(Object, Dialect)
|
|
Method name: void set(PreparedStatement, Object, int)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | String code;↵ | | 1 | Object code;↵
|
2 | try {↵ | | 2 | try {↵
|
3 | code = (String) CURRENCY_GET_CODE.invoke(value, null);↵ | | 3 | code = CURRENCY_GET_CODE.invoke(value, null);↵
|
4 | }↵ | | 4 | }↵
|
5 | catch (Exception e) {↵ | | 5 | catch (Exception e) {↵
|
6 | throw new HibernateException("Could not get Currency code", e);↵ | | 6 | throw new HibernateException("Could not get Currency code", e);↵
|
7 | }↵ | | 7 | }↵
|
8 | return ( (LiteralType) Hibernate.STRING ).objectToSQLString(code, dialect); | | 8 | Hibernate.STRING.set(st, code, index);
|
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
| | | 1 | Object code; |
1 | String code; | | | |
2 | try | | 2 | try |
| | | 3 | code = CURRENCY_GET_CODE.invoke(value, null); |
3 | code = (String)CURRENCY_GET_CODE.invoke(value, null); | | | |
| | | 4 | Hibernate.STRING.set(st, code, index); |
4 | return ((LiteralType)Hibernate.STRING).objectToSQLString(code, dialect); | | | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement code=CURRENCY_GET_CODE.invoke(value,null); 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 | Unmatched statement code=(String)CURRENCY_GET_CODE.invoke(value,null); 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 |
3 | Unmatched return ((LiteralType)Hibernate.STRING).objectToSQLString(code,dialect); |