jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r892263 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint: NodeLocalNameOperand.java NodeNameOperand.java PropertyValueOperand.java
Date Fri, 18 Dec 2009 14:46:47 GMT
Author: mreutegg
Date: Fri Dec 18 14:46:45 2009
New Revision: 892263

URL: http://svn.apache.org/viewvc?rev=892263&view=rev
Log:
JCR-2444: Exception executing SQL2/JQOM with non-admin session

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeLocalNameOperand.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeNameOperand.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/PropertyValueOperand.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeLocalNameOperand.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeLocalNameOperand.java?rev=892263&r1=892262&r2=892263&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeLocalNameOperand.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeLocalNameOperand.java
Fri Dec 18 14:46:45 2009
@@ -16,11 +16,12 @@
  */
 package org.apache.jackrabbit.core.query.lucene.constraint;
 
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 
-import org.apache.jackrabbit.core.query.lucene.ScoreNode;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.query.lucene.ScoreNode;
 import org.apache.jackrabbit.util.Text;
 
 /**
@@ -41,8 +42,13 @@
     public Value[] getValues(ScoreNode sn, EvaluationContext context)
             throws RepositoryException {
         SessionImpl session = context.getSession();
-        String name = session.getNodeById(sn.getNodeId()).getName();
-        return new Value[]{session.getValueFactory().createValue(
-                Text.getLocalName(name))};
+        try {
+            String name = session.getNodeById(sn.getNodeId()).getName();
+            return new Value[]{session.getValueFactory().createValue(
+                    Text.getLocalName(name))};
+        } catch (ItemNotFoundException e) {
+            // access denied to score node
+            return new Value[0];
+        }
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeNameOperand.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeNameOperand.java?rev=892263&r1=892262&r2=892263&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeNameOperand.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/NodeNameOperand.java
Fri Dec 18 14:46:45 2009
@@ -16,12 +16,13 @@
  */
 package org.apache.jackrabbit.core.query.lucene.constraint;
 
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.PropertyType;
 
-import org.apache.jackrabbit.core.query.lucene.ScoreNode;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.query.lucene.ScoreNode;
 
 /**
  * <code>NodeNameOperand</code> implements a node name operand.
@@ -40,7 +41,12 @@
     public Value[] getValues(ScoreNode sn, EvaluationContext context)
             throws RepositoryException {
         SessionImpl session = context.getSession();
-        String name = session.getNodeById(sn.getNodeId()).getName();
-        return new Value[]{session.getValueFactory().createValue(name, PropertyType.NAME)};
+        try {
+            String name = session.getNodeById(sn.getNodeId()).getName();
+            return new Value[]{session.getValueFactory().createValue(name, PropertyType.NAME)};
+        } catch (ItemNotFoundException e) {
+            // access denied to score node
+            return new Value[0];
+        }
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/PropertyValueOperand.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/PropertyValueOperand.java?rev=892263&r1=892262&r2=892263&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/PropertyValueOperand.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/constraint/PropertyValueOperand.java
Fri Dec 18 14:46:45 2009
@@ -16,20 +16,21 @@
  */
 package org.apache.jackrabbit.core.query.lucene.constraint;
 
-import javax.jcr.Value;
-import javax.jcr.Property;
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
 import javax.jcr.RepositoryException;
+import javax.jcr.Value;
 
-import org.apache.jackrabbit.spi.commons.query.qom.PropertyValueImpl;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.query.lucene.ScoreNode;
-import org.apache.jackrabbit.core.state.ItemStateManager;
-import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.id.PropertyId;
-import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.spi.commons.query.qom.PropertyValueImpl;
 
 /**
  * <code>PropertyValueOperand</code> implements a property value operand.
@@ -90,7 +91,11 @@
         try {
             Node n = session.getNodeById(sn.getNodeId());
             return n.getProperty(operand.getPropertyName());
+        } catch (ItemNotFoundException e) {
+            // access denied to score node
+            return null;
         } catch (PathNotFoundException e) {
+            // property not found
             return null;
         }
     }



Mime
View raw message