summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-11-16 13:17:29 +0100
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-11-16 13:42:47 +0100
commit677d218e4c337de6faca915723d47390ef4290d0 (patch)
treeb1b8ce87f45d78a59a7567f9e3900ddeb48a11b9 /src/main/java/org
parent78c8b0e7fc7e6d707190202cac4b8f2ad03828dc (diff)
Rework the CldsUserJson
Rework the CldsUserJson and associated Unit tests Change-Id: I0be23ef8c6a44bc7cec7f7011b08a32d2662c56f Issue-ID: CLAMP-74 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java b/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java
index ecfb4aa11..15d06b9af 100644
--- a/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java
+++ b/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java
@@ -28,23 +28,29 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
+import org.onap.clamp.clds.exception.CldsUsersException;
import org.onap.clamp.clds.service.CldsUser;
public class CldsUserJsonDecoder {
-
/**
* This method decodes the JSON file provided to a CldsUser Array. The
* stream is closed after this call, this is not possible to reuse it.
*
+ * @param cldsUsersFile
+ * The inputStream containing the users json file
* @return CldsUser[] Array containing a list of the user defined in the
* JSON file
*/
- public static CldsUser[] decodeJson(InputStream cldsUsersFile) throws IOException {
- // the ObjectMapper readValue method closes the stream no need to do it
- return new ObjectMapper().readValue(cldsUsersFile, CldsUser[].class);
+ public static CldsUser[] decodeJson(InputStream cldsUsersFile) {
+ try {
+ // the ObjectMapper readValue method closes the stream no need to do
+ // it
+ return new ObjectMapper().readValue(cldsUsersFile, CldsUser[].class);
+ } catch (IOException e) {
+ throw new CldsUsersException("Exception occurred during the decoding of the clds-users.json", e);
+ }
}
private CldsUserJsonDecoder() {
-
}
}