update the N1QL example Code
@@ -3,14 +3,18 @@ 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<JsonNode> extractJsonResult(N1qlQueryResult result) {
return result.allRows().stream()
@@ -18,7 +22,7 @@ public class CodeSnippets {
try {
return objectMapper.readTree(row.value().toString());
}catch (IOException e) {
- e.printStackTrace();
+ logger.log(Level.WARNING, e.getLocalizedMessage());
return null;
}
})
