if (!begun) return false; final int status; try { status = getTransaction().getStatus(); } catch (SystemException se) { log.error("Could not determine transaction status", se); throw new TransactionException("Could not determine transaction status: ", se); } if (status==Status.STATUS_UNKNOWN) { throw new TransactionException("Could not determine transaction status"); } else { return status==Status.STATUS_ACTIVE; }
if ( !begun ) return false; final int status; try { status = getTransaction().getStatus(); } catch (SystemException se) { log.error("Could not determine transaction status", se); throw new TransactionException("Could not determine transaction status: ", se); } if (status==Status.STATUS_UNKNOWN) { throw new TransactionException("Could not determine transaction status"); } else { return status==Status.STATUS_COMMITTED; }
Clone fragments detected by clone detection tool
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 isActive() 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 status==Status.STATUS_ACTIVE;
14
			return status==Status.STATUS_COMMITTED;
15
		}
15
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are declared in the same class
Number of node comparisons37
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    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.9
    Clone typeType 2
    Mapped Statements
    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 status == Status.STATUS_ACTIVE;
    8
    return status == Status.STATUS_ACTIVE;
    8
    return status == Status.STATUS_COMMITTED;
    Differences
    Expression1Expression2Difference
    STATUS_ACTIVESTATUS_COMMITTEDVARIABLE_NAME_MISMATCH
    8
    return status == Status.STATUS_COMMITTED;
    Precondition Violations (0)
    Row Violation