Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Prevent NPE when using IsolationLevel.NONE.
Browse files Browse the repository at this point in the history
  • Loading branch information
broneill committed Apr 13, 2013
1 parent b926a08 commit a9992bb
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/main/java/com/amazon/carbonado/txn/TransactionScope.java
Expand Up @@ -597,21 +597,26 @@ <S extends Storable> void unregister(Cursor<S> cursor) {
// Caller must hold mLock.
Txn getTxn() throws Exception {
TransactionScope<Txn> scope = mScope;
if (mTxn != null) {
scope.mTxnMgr.reuseTxn(mTxn);
Txn txn = mTxn;
if (txn != null) {
scope.mTxnMgr.reuseTxn(txn);
if (mForUpdate) {
scope.mTxnMgr.setForUpdate(txn, true);
}
} else {
Txn parentTxn = (mParent == null || mTop) ? null : mParent.getTxn();
if (mTimeoutUnit == null) {
mTxn = scope.mTxnMgr.createTxn(parentTxn, mLevel);
txn = scope.mTxnMgr.createTxn(parentTxn, mLevel);
} else {
mTxn = scope.mTxnMgr.createTxn(parentTxn, mLevel,
mDesiredLockTimeout, mTimeoutUnit);
txn = scope.mTxnMgr.createTxn(parentTxn, mLevel,
mDesiredLockTimeout, mTimeoutUnit);
}
mTxn = txn;
if (mForUpdate & txn != null) {
scope.mTxnMgr.setForUpdate(txn, true);
}
}
if (mForUpdate) {
scope.mTxnMgr.setForUpdate(mTxn, true);
}
return mTxn;
return txn;
}

// Caller must hold mLock.
Expand Down

0 comments on commit a9992bb

Please sign in to comment.