Transaction tx = getCurrentTransaction();
if ( tx == null ) {
throw new IllegalStateException( "no current transaction" );
}
tx.rollback();
Transaction tx = getCurrentTransaction();
if ( tx == null ) {
throw new IllegalStateException( "no current transaction" );
}
tx.setRollbackOnly();
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/util/DualNodeJtaTransactionManagerImpl.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/util/DualNodeJtaTransactionManagerImpl.java
|
Method name: void rollback()
|
|
Method name: void setRollbackOnly()
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | Transaction tx = getCurrentTransaction();↵ | | 1 | Transaction tx = getCurrentTransaction();↵
|
2 | if ( tx == null ) {↵ | | 2 | if ( tx == null ) {↵
|
3 | throw new IllegalStateException( "no current transaction" );↵ | | 3 | throw new IllegalStateException( "no current transaction" );↵
|
4 | }↵ | | 4 | }↵
|
5 | tx.rollback(); | | 5 | tx.setRollbackOnly();
|
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | Transaction tx = getCurrentTransaction(); | | 1 | Transaction tx = getCurrentTransaction(); |
2 | if (tx == null) | | 2 | if (tx == null) |
3 | throw new IllegalStateException("no current transaction"); | | 3 | throw new IllegalStateException("no current transaction"); |
4 | tx.rollback(); | | 4 | tx.setRollbackOnly(); |
Precondition Violations (4)
Row |
Violation |
1 | Expression tx.rollback() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression tx.setRollbackOnly() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression tx.rollback() is a void method call, and thus it cannot be parameterized |
4 | Expression tx.setRollbackOnly() is a void method call, and thus it cannot be parameterized |