db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject [db-jdo] 32/43: JDO-399, JDO-395: merge changes from trunk into branch 2.0.1
Date Fri, 07 May 2021 23:12:14 GMT
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 <mbo@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);
+        }
     }
 
     /** 

Mime
View raw message