diff options
author | Marcin Migdal <marcin.migdal@nokia.com> | 2019-04-24 15:28:21 +0200 |
---|---|---|
committer | Marcin Migdal <marcin.migdal@nokia.com> | 2019-04-24 15:29:22 +0200 |
commit | 22d2c8bd1f19f180e3c9fb5602f97fc63f88a8bd (patch) | |
tree | f7eff207bf5d659e8ece0d0130e3b77548d20f71 /prh-app-server/src/main/java | |
parent | ebeb7862f352dbbbaede4eecd511a5b102eea666 (diff) |
Fix logging
Change-Id: I9dd88e87385f828ec4301578fe34fd45d50dab58
Issue-ID: DCAEGEN2-1361
Signed-off-by: Marcin Migdal <marcin.migdal@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java')
-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()); |