if ( rootSession == null && tx != null ) {
try {
interceptor.afterTransactionCompletion(tx);
}
catch (Throwable t) {
log.error("exception in interceptor afterTransactionCompletion()", t);
}
}
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/core/src/main/java/org/hibernate/impl/SessionImpl.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java
|
Method name: void afterTransactionCompletion(boolean, Transaction)
|
|
Method name: void cleanupAnyOrphanedSession(SessionFactory)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | if ( rootSession == null && tx != null ) {↵ | | 1 | if ( orphan.getTransaction() != null && orphan.getTransaction().isActive() ) {↵
|
2 | try {↵ | | 2 | try {↵
|
3 | interceptor.afterTransactionCompletion(tx);↵ | | 3 | orphan.getTransaction().rollback();↵
|
4 | }↵ | | 4 | }↵
|
5 | catch (Throwable t) {↵ | | 5 | catch( Throwable t ) {↵
|
6 | log.error("exception in interceptor afterTransactionCompletion()", t);↵ | | 6 | log.debug( "Unable to rollback transaction for orphaned session", t );↵
|
7 | }↵ | | 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) | 7.4 |
Clones location | Clones are in different classes |
Number of node comparisons | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | try | | 6 | try |
6 | interceptor.afterTransactionCompletion(tx); | | | |
| | | 7 | orphan.getTransaction().rollback(); |
Precondition Violations (2)
Row |
Violation |
1 | Expression log.error("exception in interceptor afterTransactionCompletion()",t) 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 |