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 JTAHelper.isRollback(status); }
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 wasRolledBack()
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 JTAHelper.isRollback(status);
15
		}
15
		}
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.5
Clones locationClones are declared in the same class
Number of node comparisons37
  1. {Non-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)1.0
    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
    4
    try
    Differences
    Expression1Expression2Difference
    "Could not determine transaction status: ""Could not determine transaction status"LITERAL_VALUE_MISMATCH
    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 JTAHelper.isRollback(status);
    Differences
    Expression1Expression2Difference
    status == Status.STATUS_ACTIVEJTAHelper.isRollback(status)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression status == Status.STATUS_ACTIVE cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression JTAHelper.isRollback(status) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    return JTAHelper.isRollback(status);
    Precondition Violations (2)
    Row Violation
    1Expression status == Status.STATUS_ACTIVE cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression JTAHelper.isRollback(status) cannot be parameterized, because it has dependencies to/from statements that will be extracted