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