if ( connection != null ) { try { connection.rollback(); connection.close(); } catch ( SQLException sqle ) { status = Status.STATUS_UNKNOWN; throw new SystemException(); } }
if ( connection != null ) { try { connection.commit(); 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 rollback() Method name: void commit()
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( connection != null ) {
1
if ( connection != null ) {
2
			try {
2
				try {
3
				connection.rollback();
3
					connection.commit();
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
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (connection != null)
    9
    if (connection != null)
    3
    try
    10
    try
    4
    connection.rollback();
    4
    connection.rollback();
    11
    connection.commit();
    Differences
    Expression1Expression2Difference
    rollbackcommitMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression connection.rollback() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression connection.commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression connection.rollback() is a void method call, and thus it cannot be parameterized
    Expression connection.commit() is a void method call, and thus it cannot be parameterized
    11
    connection.commit();
    5
    connection.close();
    12
    connection.close();
    Precondition Violations (4)
    Row Violation
    1Expression connection.rollback() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression connection.commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression connection.rollback() is a void method call, and thus it cannot be parameterized
    4Expression connection.commit() is a void method call, and thus it cannot be parameterized