Browse Source

fixed WebSphereUowTransactionManager regression: correctly roll back in case of exception (SPR-6695)

pull/23217/head
Juergen Hoeller 16 years ago
parent
commit
41ecbc6814
  1. 3
      org.springframework.transaction/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java
  2. 13
      org.springframework.transaction/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java

3
org.springframework.transaction/src/main/java/org/springframework/transaction/jta/WebSphereUowTransactionManager.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -339,6 +339,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager @@ -339,6 +339,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
}
catch (Throwable ex) {
this.exception = ex;
uowManager.setRollbackOnly();
}
finally {
if (status.isLocalRollbackOnly()) {

13
org.springframework.transaction/src/test/java/org/springframework/transaction/jta/WebSphereUowTransactionManagerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,9 +20,12 @@ import javax.transaction.RollbackException; @@ -20,9 +20,12 @@ import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.UserTransaction;
import com.ibm.wsspi.uow.UOWAction;
import com.ibm.wsspi.uow.UOWException;
import com.ibm.wsspi.uow.UOWManager;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.mock.jndi.ExpectedLookupTemplate;
import org.springframework.transaction.IllegalTransactionStateException;
@ -34,10 +37,6 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; @@ -34,10 +37,6 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import com.ibm.wsspi.uow.UOWAction;
import com.ibm.wsspi.uow.UOWException;
import com.ibm.wsspi.uow.UOWManager;
/**
* @author Juergen Hoeller
*/
@ -383,7 +382,7 @@ public class WebSphereUowTransactionManagerTests extends TestCase { @@ -383,7 +382,7 @@ public class WebSphereUowTransactionManagerTests extends TestCase {
assertEquals(0, manager.getUOWTimeout());
assertEquals(UOWManager.UOW_TYPE_GLOBAL_TRANSACTION, manager.getUOWType());
assertFalse(manager.getJoined());
assertFalse(manager.getRollbackOnly());
assertTrue(manager.getRollbackOnly());
}
public void testNewTransactionWithRollbackOnly() {

Loading…
Cancel
Save