log.debug("Updating account " + id + " to branch " + branch);
tm.begin();
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;
}
log.debug("Updated account " + id + " to branch " + branch);
log.debug("Updating account " + id + " to balance " + newBalance);
tm.begin();
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;
}
log.debug("Updated account " + id + " to balance " + newBalance);
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: 9
|
|
Number of AST nodes: 9
|
|
1 | log.debug("Updating account " + id + " to branch " + branch);↵ | | 1 | log.debug("Updating account " + id + " to balance " + newBalance);↵
|
2 | tm.begin();↵ | | 2 | tm.begin();↵
|
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 | session.update(account);↵ | | 7 | session.update(account);↵
|
8 | tm.commit();↵ | | 8 | tm.commit();↵
|
9 | }↵ | | 9 | }↵
|
10 | catch (Exception e) {↵ | | 10 | catch (Exception e) {↵
|
11 | log.error("rolling back", e);↵ | | 11 | log.error("rolling back", e);↵
|
12 | tm.rollback();↵ | | 12 | tm.rollback();↵
|
13 | throw e;↵ | | 13 | throw e;↵
|
14 | }↵ | | 14 | }↵
|
15 | log.debug("Updated account " + id + " to branch " + branch); | | 15 | log.debug("Updated account " + id + " to balance " + newBalance);
|
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 | 45 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
| | | 1 | log.debug("Updating account " + id + " to balance " + newBalance); |
1 | log.debug("Updating account " + id + " to branch " + branch); | | | |
2 | tm.begin(); | | 2 | tm.begin(); |
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 | |
| | | 9 | log.debug("Updated account " + id + " to balance " + newBalance); |
9 | log.debug("Updated account " + id + " to branch " + branch); | | | |
Precondition Violations (1)
Row |
Violation |
1 | Type java.lang.String of variable branch does not match with type java.lang.Integer of variable newBalance |