diff options
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java b/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java index d0b116f71..5d8cbb05e 100644 --- a/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java +++ b/src/main/java/org/onap/policy/clamp/clds/config/sdc/SdcControllersConfiguration.java @@ -27,7 +27,6 @@ package org.onap.policy.clamp.clds.config.sdc; import com.google.gson.JsonObject; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.HashMap; @@ -38,7 +37,6 @@ import org.onap.policy.clamp.clds.util.JsonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; -import org.springframework.core.io.Resource; /** * This class maps the SDC config JSON file. This JSON can have multiple diff --git a/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java b/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java index 95d1fe182..6479cf767 100644 --- a/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java +++ b/src/main/java/org/onap/policy/clamp/configuration/ClampGsonDataFormat.java @@ -36,6 +36,7 @@ import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormatName; import org.apache.camel.support.service.ServiceSupport; import org.apache.camel.util.IOHelper; +import org.apache.commons.io.IOUtils; import org.onap.policy.clamp.clds.util.JsonUtils; public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, DataFormatName { @@ -113,7 +114,9 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D public Object unmarshal(final Exchange exchange, final InputStream stream) throws Exception { try (final InputStreamReader isr = new InputStreamReader(stream, StandardCharsets.UTF_8); final BufferedReader reader = IOHelper.buffered(isr)) { - if (unmarshalGenericType == null) { + if (unmarshalType.equals(String.class)) { + return IOUtils.toString(reader); + } else if (unmarshalGenericType == null) { return gson.fromJson(reader, unmarshalType); } else { return gson.fromJson(reader, unmarshalGenericType); |