Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2406

Change subject: [NO ISSUE][TEST] Avoid NPE on empty result from cleanup query
......................................................................

[NO ISSUE][TEST] Avoid NPE on empty result from cleanup query

Change-Id: Ic645b0f2c5ff29a6178cfd784fcbffb331386e90
---
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/06/2406/1

diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index bae1a21..b75df99 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -1649,14 +1649,18 @@
             InputStream resultStream = executeQueryService(
                     "select dv.DataverseName from Metadata.`Dataverse` as dv 
order by dv.DataverseName;",
                     getEndpoint(Servlets.QUERY_SERVICE), 
OutputFormat.CLEAN_JSON);
-            String out = IOUtils.toString(resultStream);
+            String out = IOUtils.toString(resultStream, 
StandardCharsets.UTF_8);
             ObjectMapper om = new ObjectMapper();
             
om.setConfig(om.getDeserializationConfig().with(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT));
             JsonNode result;
             try {
                 result = om.readValue(out, ObjectNode.class).get("results");
             } catch (JsonMappingException e) {
-                result = om.createArrayNode();
+                LOGGER.warn("error mapping response '{}' to json", out, e);
+                result = null;
+            }
+            if (result == null) {
+                return;
             }
             for (int i = 0; i < result.size(); i++) {
                 JsonNode json = result.get(i);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2406
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic645b0f2c5ff29a6178cfd784fcbffb331386e90
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>

Reply via email to