public void updateAccountBranch(Integer id, String branch) throws Exception { 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);
public void updateAccountBalance(Integer id, Integer newBalance) throws Exception { 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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void updateAccountBranch(Integer id, String branch) throws Exception
1
public void updateAccountBalance(Integer id, Integer newBalance) throws Exception
2
   {
2
   {
3
      log.debug("Updating account " + id + " to branch " + branch);
3
      log.debug("Updating account " + id + " to balance " + newBalance);
4
      tm.begin();
4
      tm.begin();
5
      try {
5
      try {
6
          Session session = sessionFactory.getCurrentSession();
6
          Session session = sessionFactory.getCurrentSession();
7
          Object account = session.get(acctClass, id);
7
          Object account = session.get(acctClass, id);
8
          setBranch.invoke(account, branch);
8
          setBalance.invoke(account, newBalance);
9
          session.update(account);
9
          session.update(account);
10
          tm.commit();
10
          tm.commit();
11
      }
11
      }
12
      catch (Exception e) {
12
      catch (Exception e) {
13
         log.error("rolling back", e);
13
          log.error("rolling back", e);
14
         tm.rollback();
14
          tm.rollback();
15
         throw e;
15
          throw e;
16
      }
16
      }
17
      log.debug("Updated account " + id + " to branch " + branch);
17
      log.debug("Updated account " + id + " to balance " + newBalance);
18
   
18
   
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0