File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/transaction/CMTTransaction.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/transaction/CMTTransaction.java | |||
Method name: boolean wasRolledBack()
|
Method name: boolean wasCommitted()
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | if (!begun) return false;↵ | 1 | if ( !begun ) return false;↵ | |
2 | final int status;↵ | 2 | final int status;↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | status = getTransaction().getStatus();↵ | 4 | status = getTransaction().getStatus();↵ | |
5 | }↵ | 5 | }↵ | |
6 | catch (SystemException se) {↵ | 6 | catch (SystemException se) {↵ | |
7 | log.error("Could not determine transaction status", se);↵ | 7 | log.error("Could not determine transaction status", se);↵ | |
8 | throw new TransactionException("Could not determine transaction status", se);↵ | 8 | throw new TransactionException("Could not determine transaction status: ", se);↵ | |
9 | }↵ | 9 | }↵ | |
10 | if (status==Status.STATUS_UNKNOWN) {↵ | 10 | if (status==Status.STATUS_UNKNOWN) {↵ | |
11 | throw new TransactionException("Could not determine transaction status");↵ | 11 | throw new TransactionException("Could not determine transaction status");↵ | |
12 | }↵ | 12 | }↵ | |
13 | else {↵ | 13 | else {↵ | |
14 | return JTAHelper.isRollback(status);↵ | 14 | return status==Status.STATUS_COMMITTED;↵ | |
15 | } | 15 |
| |
See real code fragment | See real code fragment |
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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 37 |
Number of mapped statements | 8 |
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.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (!begun) | 1 | if (!begun) | |||||||||||||
2 | return false; | 2 | return false; | |||||||||||||
3 | final int status; | 3 | final int status; | |||||||||||||
4 | try |
| 4 | try | ||||||||||||
5 | status = getTransaction().getStatus(); | 5 | status = getTransaction().getStatus(); | |||||||||||||
6 | if (status == Status.STATUS_UNKNOWN) | 6 | if (status == Status.STATUS_UNKNOWN) | |||||||||||||
7 | throw new TransactionException("Could not determine transaction status"); | 7 | throw new TransactionException("Could not determine transaction status"); | |||||||||||||
else | else | |||||||||||||||
8 | return JTAHelper.isRollback(status); |
| 8 | return status == Status.STATUS_COMMITTED; |
Row | Violation |
---|---|
1 | Expression JTAHelper.isRollback(status) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression status == Status.STATUS_COMMITTED cannot be parameterized, because it has dependencies to/from statements that will be extracted |