try {
BatchModeTransactionManager.getInstance().rollback();
}
catch (Exception e) {
log.error(e.getMessage(), e);
}
if ( orphan.getTransaction() != null && orphan.getTransaction().isActive() ) {
try {
orphan.getTransaction().rollback();
}
catch( Throwable t ) {
log.debug( "Unable to rollback transaction for orphaned session", t );
}
}
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/AbstractGeneralDataRegionTestCase.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java
|
Method name: void rollback()
|
|
Method name: void cleanupAnyOrphanedSession(SessionFactory)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 3
|
|
1 | try {↵ | | |
|
2 | BatchModeTransactionManager↵ | | 1 | if ( orphan.getTransaction() != null && orphan.getTransaction().isActive() ) {↵
|
| | | 2 | try {↵
|
3 | .getInstance().rollback();↵ | | 3 | orphan.getTransaction().rollback();↵
|
4 | }↵ | | |
|
5 | catch (Exception e) {↵ | | |
|
6 | log.error(e.getMessage(), e);↵ | | |
|
7 | ↵ | | 4 | }↵
|
| | | 5 | catch( Throwable t ) {↵
|
| | | 6 | log.debug( "Unable to rollback transaction for orphaned session", t );↵
|
| | | 7 | }↵
|
8 | } | | 8 | }
|
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 in different classes |
Number of node comparisons | 4 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
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.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | try | | 6 | try |
2 | BatchModeTransactionManager.getInstance().rollback(); | | 7 | orphan.getTransaction().rollback(); |
Precondition Violations (4)
Row |
Violation |
1 | Expression log.error(e.getMessage(),e) is a void method call, and thus it cannot be parameterized |
2 | Expression log.debug("Unable to rollback transaction for orphaned session",t) is a void method call, and thus it cannot be parameterized |
3 | Type org.jboss.cache.transaction.BatchModeTransactionManager of variable BatchModeTransactionManager.getInstance() does not match with type org.hibernate.Transaction of variable orphan.getTransaction() |
4 | Type org.jboss.cache.transaction.BatchModeTransactionManager of variable BatchModeTransactionManager does not match with type org.hibernate.classic.Session of variable orphan |