UI-Lion: Using try-with-resource for reading config file.
Change-Id: Ic177626fb014528cfab92d14020a15d485a73e58
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java b/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java
index f324f99..729512c 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/lion/LionConfig.java
@@ -19,9 +19,11 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSortedSet;
-import com.google.common.io.Resources;
+import com.google.common.io.CharStreams;
import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -33,7 +35,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static com.google.common.io.Resources.getResource;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
@@ -77,8 +78,9 @@
* @throws IllegalArgumentException if there is a problem reading the file
*/
public LionConfig load(String source) {
- try {
- lines = Resources.readLines(getResource(getClass(), source), UTF_8);
+ try (Reader r = new InputStreamReader(getClass().getResourceAsStream(source),
+ UTF_8)) {
+ lines = CharStreams.readLines(r);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to read: " + source, e);
}