if ( connection != null ) {
try {
connection.commit();
connection.close();
}
catch ( SQLException sqle ) {
status = Status.STATUS_UNKNOWN;
throw new SystemException();
}
}
if ( connection != null ) {
try {
connection.rollback();
connection.close();
}
catch ( SQLException sqle ) {
status = Status.STATUS_UNKNOWN;
throw new SystemException();
}
}
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/DualNodeJtaTransactionImpl.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/test/tm/SimpleJtaTransactionImpl.java
|
Method name: void commit()
|
|
Method name: void rollback()
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | if ( connection != null ) {↵ | | 1 | if ( connection != null ) {↵
|
2 | try {↵ | | 2 | try {↵
|
3 | connection.commit();↵ | | 3 | connection.rollback();↵
|
4 | connection.close();↵ | | 4 | connection.close();↵
|
5 | }↵ | | 5 | }↵
|
6 | catch ( SQLException sqle ) {↵ | | 6 | catch ( SQLException sqle ) {↵
|
7 | status = Status.STATUS_UNKNOWN;↵ | | 7 | status = Status.STATUS_UNKNOWN;↵
|
8 | throw new SystemException();↵ | | 8 | throw new SystemException();↵
|
9 | }↵ | | 9 | }↵
|
10 | } | | 10 | }
|
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.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 10 |
-
{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.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
9 | if (connection != null) | | 2 | if (connection != null) |
10 | | | 3 | |
11 | | | 4 | |
12 | | | 5 | |
Precondition Violations (4)
Row |
Violation |
1 | Expression connection.commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression connection.rollback() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression connection.commit() is a void method call, and thus it cannot be parameterized |
4 | Expression connection.rollback() is a void method call, and thus it cannot be parameterized |