diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-09-11 13:18:42 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-09-11 14:21:46 +0200 |
commit | cf87afa1bbf19cdaf8b60f1e689c2b82625c14f8 (patch) | |
tree | 805af0faa4a23515a16f0d96f477e189c51f470e /src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java | |
parent | 58b44949714b002818d20ba40d01eb50c031614d (diff) |
Checkstyle fixes
Checkstyle fixes done to solve the Unstable build
Issue-ID: CLAMP-487
Change-Id: I694b13e03dd1e7220988fd0c08bfbf12a808f7f7
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java b/src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java index e3010797..5deee467 100644 --- a/src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java +++ b/src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java @@ -55,13 +55,11 @@ public final class ResourceFileUtil { * Return resource as a String. */ public static String getResourceAsString(String name) throws IOException { - InputStream is = getResourceAsStream(name); - Scanner scanner = new Scanner(is); - Scanner delimitedScanner = scanner.useDelimiter("\\A"); - String text = delimitedScanner.hasNext() ? delimitedScanner.next() : ""; - delimitedScanner.close(); - scanner.close(); - is.close(); - return text; + try (InputStream is = getResourceAsStream(name)) { + try (Scanner scanner = new Scanner(is)) { + Scanner delimitedScanner = scanner.useDelimiter("\\A"); + return delimitedScanner.hasNext() ? delimitedScanner.next() : ""; + } + } } } |