[Mulgara-svn] r2048 - trunk/src/jar/tuples/java/org/mulgara/store/tuples

pag at mulgara.org pag at mulgara.org
Tue Sep 27 17:53:35 UTC 2011


Author: pag
Date: 2011-09-27 17:53:34 +0000 (Tue, 27 Sep 2011)
New Revision: 2048

Modified:
   trunk/src/jar/tuples/java/org/mulgara/store/tuples/AbstractTuples.java
Log:
Modified code path to ensure that the first exception thrown during a close is the one that propagates, even if further exceptions occur while finalizing

Modified: trunk/src/jar/tuples/java/org/mulgara/store/tuples/AbstractTuples.java
===================================================================
--- trunk/src/jar/tuples/java/org/mulgara/store/tuples/AbstractTuples.java	2011-09-27 17:52:46 UTC (rev 2047)
+++ trunk/src/jar/tuples/java/org/mulgara/store/tuples/AbstractTuples.java	2011-09-27 17:53:34 UTC (rev 2048)
@@ -514,6 +514,7 @@
           Tuples t1 = (Tuples) first.clone();
           Tuples t2 = (Tuples) second.clone();
 
+          TuplesException te = null;
           try {
             // Put them at the start.
             t1.beforeFirst();
@@ -546,10 +547,22 @@
             }
 
             isEqual = tuplesEqual;
+          } catch (TuplesException e) {
+            te = e;
           } finally {
-            t1.close();
-            t2.close();
+            try {
+              t1.close();
+            } catch (TuplesException e) {
+              if (te == null) te = e;
+            } finally {
+              try {
+                t2.close();
+              } catch (TuplesException e2) {
+                if (te == null) te = e2;
+              }
+            }
           }
+          if (te != null) throw te;
         }
       }
     } catch (TuplesException ex) {



More information about the Mulgara-svn mailing list