Jeroen Hoffman pushed to branch release/4.2 at cms-community / hippo-repository
Commits: d1feeb7a by Jeroen Hoffman at 2017-06-12T14:29:24+02:00 REPO-1696 [back port to 11.2] avoid NPE in ServicingSearchIndex#updateNodes by simple null checks after .next() calls (cherry picked from commit 7c073da17cab6477e57e97bc3dbaf5ff5ff87be6) - - - - - 1 changed file: - engine/src/main/java/org/hippoecm/repository/query/lucene/ServicingSearchIndex.java Changes: ===================================== engine/src/main/java/org/hippoecm/repository/query/lucene/ServicingSearchIndex.java ===================================== --- a/engine/src/main/java/org/hippoecm/repository/query/lucene/ServicingSearchIndex.java +++ b/engine/src/main/java/org/hippoecm/repository/query/lucene/ServicingSearchIndex.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2016 Hippo B.V. (http://www.onehippo.com) + * Copyright 2008-2017 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -404,15 +404,20 @@ public class ServicingSearchIndex extends SearchIndex implements HippoQueryHandl final Set<NodeId> augmentedRemove = new HashSet<>(); while (remove.hasNext()) { - augmentedRemove.add(remove.next()); + final NodeId nodeId = remove.next(); + if (nodeId != null) { + augmentedRemove.add(nodeId); + } } // NodeState does not implement equals hence we need NodeId final Map<NodeId, NodeState> augmentedAdd = new HashMap<>(); while (add.hasNext()) { final NodeState nodeState = add.next(); - // since NodeState does not have hashcode/equals impls, we need to use NodeId for equals in Map - augmentedAdd.put(nodeState.getNodeId(), nodeState); + if (nodeState != null) { + // since NodeState does not have hashcode/equals impls, we need to use NodeId for equals in Map + augmentedAdd.put(nodeState.getNodeId(), nodeState); + } } appendDocumentsThatHaveChangedChildNodesOrChangedHandles(augmentedRemove, augmentedAdd); View it on GitLab: https://code.onehippo.org/cms-community/hippo-repository/commit/d1feeb7a86c34ba4edc23a243029c796d30201cb
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn