jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1520339 - /jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
Date Thu, 05 Sep 2013 15:16:38 GMT
Author: andy
Date: Thu Sep  5 15:16:37 2013
New Revision: 1520339

URL: http://svn.apache.org/r1520339
Log:
Be very cautious as to what to trust as being transactional...

Modified:
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java?rev=1520339&r1=1520338&r2=1520339&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java Thu
Sep  5 15:16:37 2013
@@ -88,21 +88,26 @@ public class HttpAction
     public void setDataset(DatasetRef desc) {
         this.dsRef = desc ;
         this.dsg = desc.dataset ;
-        
-        if ( dsg instanceof Transactional ) {
-            transactional = (Transactional)dsg ;
-            DatasetGraph basedsg = unwrap(dsg) ;
+        DatasetGraph basedsg = unwrap(dsg) ;
+
+        if ( isTransactional(basedsg) && isTransactional(dsg) ) {
             // Use transactional if it looks safe - abort is necessary.
-            isTransactional = ( basedsg instanceof Transactional ) ;
+            transactional = (Transactional)dsg ;
+            isTransactional = true ;
         } else {
-            transactional = new DatasetGraphWithLock(dsg) ; 
+            // Unsure if safe
+            transactional = new DatasetGraphWithLock(dsg) ;
             // No real abort.
             isTransactional = false ;
         }
     }
-    
-    private DatasetGraph unwrap(DatasetGraph dsg) {
-        while ( dsg instanceof DatasetGraphWrapper ) {
+
+    private static boolean isTransactional(DatasetGraph dsg) {
+        return (dsg instanceof Transactional) ;
+    }
+
+    private static DatasetGraph unwrap(DatasetGraph dsg) {
+        while (dsg instanceof DatasetGraphWrapper) {
             dsg = ((DatasetGraphWrapper)dsg).getWrapped() ;
         }
         return dsg ;



Mime
View raw message