You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by cl...@apache.org on 2021/05/07 23:12:14 UTC

[db-jdo] 32/43: JDO-399, JDO-395: merge changes from trunk into branch 2.0.1

This is an automated email from the ASF dual-hosted git repository.

clr pushed a commit to branch origin/2.0.1
in repository https://gitbox.apache.org/repos/asf/db-jdo.git

commit 26a322c2106bed1c7c9f4d85d94e055244e16b19
Author: Michael Bouschen <mb...@apache.org>
AuthorDate: Wed Oct 4 19:12:49 2006 +0000

    JDO-399, JDO-395: merge changes from trunk into branch 2.0.1
---
 .../tck/lifecycle/NontransactionalWriteTest.java   | 35 +++++++++++++---------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java b/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
index 9a19be5..c466fc6 100644
--- a/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
+++ b/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
@@ -127,16 +127,19 @@ abstract public class NontransactionalWriteTest extends JDO_Test {
      */
     protected void checkXValue(String location, int expectedXValue) {
         PersistenceManager pmCheck = pmf.getPersistenceManager();
-        pmCheck.currentTransaction().begin();
-        VersionedPCPoint instance = 
+        try {
+            pmCheck.currentTransaction().begin();
+            VersionedPCPoint instance = 
                 (VersionedPCPoint)pmCheck.getObjectById(oid, true);
-        int actualXValue = instance.getX();
-        pmCheck.currentTransaction().commit();
-        cleanupPM(pmCheck);
-        if (expectedXValue != actualXValue) {
-            appendMessage(location + NL + 
-                    "expected: " + expectedXValue + NL +
-                    "  actual: " + actualXValue);
+            int actualXValue = instance.getX();
+            pmCheck.currentTransaction().commit();
+            if (expectedXValue != actualXValue) {
+                appendMessage(location + NL + 
+                              "expected: " + expectedXValue + NL +
+                              "  actual: " + actualXValue);
+            }
+        } finally {
+            cleanupPM(pmCheck);
         }
     }
 
@@ -148,12 +151,16 @@ abstract public class NontransactionalWriteTest extends JDO_Test {
      */
     protected void conflictingUpdate() {
         PersistenceManager pmConflict = pmf.getPersistenceManager();
-        pmConflict.currentTransaction().setOptimistic(false);
-        VersionedPCPoint instance = 
+        try {
+            pmConflict.currentTransaction().setOptimistic(false);
+            pmConflict.currentTransaction().begin();
+            VersionedPCPoint instance = 
                 (VersionedPCPoint)pmConflict.getObjectById(oid);
-        instance.setX(conflictXValue);
-        pmConflict.currentTransaction().commit();
-        cleanupPM(pmConflict);
+            instance.setX(conflictXValue);
+            pmConflict.currentTransaction().commit();
+        } finally {
+            cleanupPM(pmConflict);
+        }
     }
 
     /**