diff options
author | 2019-04-24 14:20:41 +0000 | |
---|---|---|
committer | 2019-04-24 14:20:41 +0000 | |
commit | 909b566306cd7e1a71cb18749e2ee064cf736cb7 (patch) | |
tree | 88aecd5e2d16213a480b982a47b532dad896ae95 /prh-app-server/src/main/java/org | |
parent | 49097b571e920255dfb85a4bf61d3522c096242b (diff) | |
parent | 22d2c8bd1f19f180e3c9fb5602f97fc63f88a8bd (diff) |
Merge "Fix logging"1.2.2
Diffstat (limited to 'prh-app-server/src/main/java/org')
-rw-r--r-- | prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java index 319b3511..43d6922a 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java @@ -41,7 +41,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.google.gson.JsonPrimitive; import java.util.Optional; import java.util.stream.StreamSupport; import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException; @@ -85,18 +84,14 @@ public class DmaapConsumerJsonParser { private Flux<ConsumerDmaapModel> getConsumerDmaapModelFromJsonArray(JsonElement jsonElement) { LOGGER.debug("DmaapConsumerJsonParser input for parsing: {}", jsonElement); - if (jsonElement instanceof JsonPrimitive) { - LOGGER.debug("Response from DMaaP is Json primitive"); - return Flux.empty(); - } if (jsonElement instanceof JsonObject) { - LOGGER.debug("Response from DMaaP is JsonObject"); + LOGGER.debug("Element is JsonObject"); return create(Flux.just((JsonObject) jsonElement)); } if (jsonElement instanceof JsonArray) { - LOGGER.debug("Response from DMaaP is JsonArray"); + LOGGER.debug("Element is JsonArray"); JsonArray jsonArray = (JsonArray) jsonElement; if (jsonArray.size() == 0) { LOGGER.debug("Nothing to consume from DMaaP"); @@ -108,11 +103,11 @@ public class DmaapConsumerJsonParser { .orElseGet(JsonObject::new))))); } - LOGGER.debug("DmaapConsumerJsonParser input object type not recognized "); + LOGGER.warn("Element is neither JSON Object or Array"); return Flux.empty(); } - public Optional<JsonObject> getJsonObjectFromAnArray(JsonElement element) { + Optional<JsonObject> getJsonObjectFromAnArray(JsonElement element) { JsonParser jsonParser = new JsonParser(); return element.isJsonPrimitive() ? Optional.of(jsonParser.parse(element.getAsString()).getAsJsonObject()) : Optional.of(jsonParser.parse(element.toString()).getAsJsonObject()); |