jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1461454 - in /jackrabbit/oak/trunk/oak-solr-core/src: main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/UpToDateNodeStateConfiguration.java test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
Date Wed, 27 Mar 2013 08:56:03 GMT
Author: tommaso
Date: Wed Mar 27 08:56:02 2013
New Revision: 1461454

URL: http://svn.apache.org/r1461454
Log:
OAK-720 - avoid possible NPE in UpToDate NSC

Modified:
    jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/UpToDateNodeStateConfiguration.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java

Modified: jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/UpToDateNodeStateConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/UpToDateNodeStateConfiguration.java?rev=1461454&r1=1461453&r2=1461454&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/UpToDateNodeStateConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/UpToDateNodeStateConfiguration.java
Wed Mar 27 08:56:02 2013
@@ -37,7 +37,10 @@ public class UpToDateNodeStateConfigurat
     protected NodeState getConfigurationNodeState() {
         NodeState currentState = store.getRoot();
         for (String child : path.split("/")) {
-            currentState = currentState.getChildNode(child);
+            NodeState childNode = currentState.getChildNode(child);
+            if (childNode != null) {
+                currentState = childNode;
+            }
         }
         return currentState;
     }

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java?rev=1461454&r1=1461453&r2=1461454&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
Wed Mar 27 08:56:02 2013
@@ -78,15 +78,7 @@ public class SolrIndexQueryTest extends 
 
     private NodeState createMockedConfigurationNodeState() {
         NodeState mockedNodeState = mock(NodeState.class);
-        when(mockedNodeState.getProperty(anyString())).thenReturn(null);
-//        when(mockedNodeState.getProperty(OakSolrNodeStateConfiguration.Properties.SOLRHOME_PATH)).
-//                thenReturn(PropertyStates.createProperty(OakSolrNodeStateConfiguration.Properties.SOLRHOME_PATH,
TestUtils.SOLR_HOME_PATH));
-//        when(mockedNodeState.getProperty(OakSolrNodeStateConfiguration.Properties.SOLRCONFIG_PATH)).
-//                thenReturn(PropertyStates.createProperty(OakSolrNodeStateConfiguration.Properties.SOLRCONFIG_PATH,
TestUtils.SOLRCONFIG_PATH));
-//        when(mockedNodeState.getProperty(OakSolrNodeStateConfiguration.Properties.PATH_FIELD)).
-//                thenReturn(PropertyStates.createProperty(OakSolrNodeStateConfiguration.Properties.PATH_FIELD,
"path_exact"));
-//        when(mockedNodeState.getProperty(OakSolrNodeStateConfiguration.Properties.COMMIT_POLICY)).
-//                thenReturn(PropertyStates.createProperty(OakSolrNodeStateConfiguration.Properties.COMMIT_POLICY,
"HARD"));
+        when(mockedNodeState.getProperty(anyString())).thenReturn(null); // this triggers
defaults
         return mockedNodeState;
     }
 



Mime
View raw message