You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2018/11/30 11:54:29 UTC

[sling-ide-tooling] branch master updated: Remove null pointer warning in Eclipse.

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-ide-tooling.git


The following commit(s) were added to refs/heads/master by this push:
     new 9bfe1d2  Remove null pointer warning in Eclipse.
9bfe1d2 is described below

commit 9bfe1d2032ca4efca44ace449d30ccd8530edd30
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Nov 30 12:52:29 2018 +0100

    Remove null pointer warning in Eclipse.
    
    Throw a real exception in case a "null" value for required node type is
    experienced.
---
 .../org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/shared/modules/impl-vlt/src/main/java/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java b/shared/modules/impl-vlt/src/main/java/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
index 0568a1f..fc7d516 100644
--- a/shared/modules/impl-vlt/src/main/java/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
+++ b/shared/modules/impl-vlt/src/main/java/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
@@ -310,17 +310,18 @@ public class VltNodeTypeFactory {
     }
 
     private void initAllowedPrimaryChildNodeTypes(VltNodeType nt0) throws RepositoryException {
-        NodeDefinition[] declaredCihldNodeDefinitions = nt0.getDeclaredChildNodeDefinitions();
+        NodeDefinition[] declaredChildNodeDefinitions = nt0.getDeclaredChildNodeDefinitions();
         Set<String> allowedChildNodeTypes = new HashSet<>();
-        if (declaredCihldNodeDefinitions!=null) {
-            for (int i = 0; i < declaredCihldNodeDefinitions.length; i++) {
-                NodeDefinition nodeDefinition = declaredCihldNodeDefinitions[i];
+        if (declaredChildNodeDefinitions!=null) {
+            for (int i = 0; i < declaredChildNodeDefinitions.length; i++) {
+                NodeDefinition nodeDefinition = declaredChildNodeDefinitions[i];
                 NodeType[] requiredPrimaryTypes = nodeDefinition.getRequiredPrimaryTypes();
                 if (requiredPrimaryTypes!=null) {
                     for (int j = 0; j < requiredPrimaryTypes.length; j++) {
                         VltNodeType aRequiredPrimaryType = (VltNodeType) requiredPrimaryTypes[j];
                         if (aRequiredPrimaryType==null) {
-                            System.out.println("this can not be");
+                            throw new IllegalStateException("Found a required primary type with value 'null' in the array returned via " +
+                            "'nodeDefinition.getRequiredPrimaryTypes()' for type: " + nodeDefinition.getName());
                         }
                         Set<VltNodeType> allKnownChildTypes = aRequiredPrimaryType.getAllKnownChildTypes();
                         for (Iterator<VltNodeType> it = allKnownChildTypes.iterator(); it.hasNext();) {