Skip to content

Commit

Permalink
fix(ZNTA-1597): Check for null pos and description
Browse files Browse the repository at this point in the history
  • Loading branch information
djansen-redhat committed Feb 16, 2018
1 parent 74ffe53 commit 2ca476c
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -20,6 +20,7 @@
*/
package org.zanata.client.commands.glossary.search;

import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
Expand Down Expand Up @@ -102,7 +103,12 @@ private void printFind(String jsonResponse) throws Exception {
log.debug("Entry: {}", resultNode);
log.info("Result:");
log.info("ID: {}", resultNode.get("id").asText());
log.info("Part of Speech: {}", resultNode.get("pos").asText());
log.info("Part of Speech: {}",
ObjectUtils.firstNonNull(resultNode.get("pos").asText(),
StringUtils.EMPTY));
log.info("Description: {}",
ObjectUtils.firstNonNull(resultNode.get("description").asText(),
StringUtils.EMPTY));
List<String> contents = new ArrayList<>();
JsonNode content = resultNode.get("glossaryTerms");
if (content.isArray()) {
Expand Down

0 comments on commit 2ca476c

Please sign in to comment.