summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml2
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/SwaggerResource.java17
2 files changed, 15 insertions, 4 deletions
diff --git a/pom.xml b/pom.xml
index 5a49a08..fa1bd43 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
<dependency>
<groupId>org.onap.holmes.common</groupId>
<artifactId>holmes-actions</artifactId>
- <version>${project.version}</version>
+ <version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/SwaggerResource.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/SwaggerResource.java
index df5a8f1..8376daf 100644
--- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/SwaggerResource.java
+++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/SwaggerResource.java
@@ -43,11 +43,13 @@ public class SwaggerResource {
public String getSwaggerJson() {
URL url = SwaggerResource.class.getResource("/swagger.json");
String ret = "{}";
+
+ BufferedReader br = null;
try {
System.out.println(URLDecoder.decode(url.getPath(), "UTF-8"));
File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
- BufferedReader br = new BufferedReader(new FileReader(file));
+ br = new BufferedReader(new FileReader(file));
StringBuffer buffer = new StringBuffer();
String line = " ";
while ((line = br.readLine()) != null) {
@@ -55,10 +57,19 @@ public class SwaggerResource {
}
ret = buffer.toString();
} catch (FileNotFoundException e) {
- log.warn("Failed to read the API description file.");
+ log.warn("Failed to read the API description file.", e);
} catch (IOException e) {
- log.warn("An error occurred while reading swagger.json.");
+ log.warn("An error occurred while reading swagger.json.", e);
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ log.warn("Failed to close the file reader. This may cause memory leak.");
+ }
+ }
}
+
return ret;
}
}