You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2020/06/09 13:26:08 UTC

[sling-org-apache-sling-graphql-core] branch master updated: tweaks

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

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-graphql-core.git


The following commit(s) were added to refs/heads/master by this push:
     new f9758b3  tweaks
f9758b3 is described below

commit f9758b3c275495e70ed3fa1fa8b95fdbea5bc7f6
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Jun 9 15:25:46 2020 +0200

    tweaks
---
 .../sling/graphql/core/scripting/GraphQLScriptEngine.java      | 10 ++++++----
 .../org/apache/sling/graphql/core/it/ServerSideQueryIT.java    |  1 -
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/graphql/core/scripting/GraphQLScriptEngine.java b/src/main/java/org/apache/sling/graphql/core/scripting/GraphQLScriptEngine.java
index 116577c..771620a 100644
--- a/src/main/java/org/apache/sling/graphql/core/scripting/GraphQLScriptEngine.java
+++ b/src/main/java/org/apache/sling/graphql/core/scripting/GraphQLScriptEngine.java
@@ -92,10 +92,12 @@ public class GraphQLScriptEngine extends AbstractScriptEngine {
      */
     private String [] getRequestSelectors(Resource r) {
         final List<String> result = new ArrayList<>();
-        final String pathInfo = r.getResourceMetadata().getResolutionPathInfo();
-        if(pathInfo != null && pathInfo.startsWith(".")) {
-            final String [] parts = pathInfo.split("\\.");
-            Arrays.stream(parts).limit(parts.length - 1).forEach(it -> result.add(it));
+        if(r != null) {
+            final String pathInfo = r.getResourceMetadata().getResolutionPathInfo();
+            if(pathInfo != null && pathInfo.startsWith(".")) {
+                final String [] parts = pathInfo.split("\\.");
+                Arrays.stream(parts).limit(parts.length - 1).forEach(it -> result.add(it));
+            }
         }
         return result.toArray(new String[] {});
     }
diff --git a/src/test/java/org/apache/sling/graphql/core/it/ServerSideQueryIT.java b/src/test/java/org/apache/sling/graphql/core/it/ServerSideQueryIT.java
index 5b82bd0..a1509b5 100644
--- a/src/test/java/org/apache/sling/graphql/core/it/ServerSideQueryIT.java
+++ b/src/test/java/org/apache/sling/graphql/core/it/ServerSideQueryIT.java
@@ -26,7 +26,6 @@ import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
 import org.apache.sling.graphql.api.SchemaProvider;
 import org.apache.sling.graphql.core.mocks.ReplacingSchemaProvider;
 import org.apache.sling.resource.presence.ResourcePresence;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;