try {
Session session = sessionFactory.getCurrentSession();
Object account = session.get(acctClass, id);
setBranch.invoke(account, branch);
session.update(account);
tm.commit();
}
catch (Exception e) {
log.error("rolling back", e);
tm.rollback();
throw e;
}
try {
Session session = sessionFactory.getCurrentSession();
Object account = session.get(acctClass, id);
setBalance.invoke(account, newBalance);
session.update(account);
tm.commit();
}
catch (Exception e) {
log.error("rolling back", e);
tm.rollback();
throw e;
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/ClassLoaderTestDAO.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/ClassLoaderTestDAO.java
|
Method name: void updateAccountBranch(Integer, String)
|
|
Method name: void updateAccountBalance(Integer, Integer)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | try {↵ | | 1 | try {↵
|
2 | Session session = sessionFactory.getCurrentSession();↵ | | 2 | Session session = sessionFactory.getCurrentSession();↵
|
3 | Object account = session.get(acctClass, id);↵ | | 3 | Object account = session.get(acctClass, id);↵
|
4 | setBranch.invoke(account, branch);↵ | | 4 | setBalance.invoke(account, newBalance);↵
|
5 | session.update(account);↵ | | 5 | session.update(account);↵
|
6 | tm.commit();↵ | | 6 | tm.commit();↵
|
7 | }↵ | | 7 | }↵
|
8 | catch (Exception e) {↵ | | 8 | catch (Exception e) {↵
|
9 | log.error("rolling back", e);↵ | | 9 | log.error("rolling back", e);↵
|
10 | tm.rollback();↵ | | 10 | tm.rollback();↵
|
11 | throw e;↵ | | 11 | throw e;↵
|
12 | } | | 12 | }
|
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 | 36 |
-
{Non-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) | 1.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 3 | try |
4 | Session session = sessionFactory.getCurrentSession(); | | 4 | Session session = sessionFactory.getCurrentSession(); |
5 | Object account = session.get(acctClass, id); | | 5 | Object account = session.get(acctClass, id); |
6 | setBranch.invoke(account, branch); | | 6 | setBalance.invoke(account, newBalance); |
7 | | | 7 | |
8 | | | 8 | |
Precondition Violations (1)
Row |
Violation |
1 | Type java.lang.String of variable branch does not match with type java.lang.Integer of variable newBalance |