From 562b9fc2fe5eb78eab0988b21f287ac86acc8cfe Mon Sep 17 00:00:00 2001 From: Seun Matt Date: Mon, 18 Sep 2017 17:39:20 +0100 Subject: [PATCH] Updated extractJsonResult method (#2639) * added updated example codes * updated example code StringToCharStream * deleted StringToCharStream.java locally * removed redundant file * added code for apache commons collection SetUtils * refactored example code * added example code for bytebuddy * added example code for PCollections * update pom * refactored tests for PCollections * spring security xml config * spring security xml config * remove redundant comment * example code for apache-shiro * updated example code for Vavr Collections * updated Vavr's Collection example * updated Vavr Collection file * updated example code for Apache Shiro * updated Vavr Collections example * added example code for N1QL * update example code for N1QL * added integration test for N1QL * update N1QL Example code * update the N1QL example Code --- .../java/com/baeldung/couchbase/n1ql/CodeSnippets.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java b/couchbase-sdk/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java index 9e9f204263..45067911cb 100644 --- a/couchbase-sdk/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java +++ b/couchbase-sdk/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java @@ -3,22 +3,27 @@ package com.baeldung.couchbase.n1ql; import com.couchbase.client.java.query.N1qlQueryResult; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; + import java.io.IOException; import java.util.List; import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.stream.Collectors; public class CodeSnippets { private static ObjectMapper objectMapper = new ObjectMapper(); + private static final Logger logger = Logger.getLogger(CodeSnippets.class.getName()); + public static List extractJsonResult(N1qlQueryResult result) { return result.allRows().stream() .map(row -> { try { return objectMapper.readTree(row.value().toString()); }catch (IOException e) { - e.printStackTrace(); + logger.log(Level.WARNING, e.getLocalizedMessage()); return null; } })