diff options
author | 2018-07-16 17:27:59 +0900 | |
---|---|---|
committer | 2018-07-16 17:28:37 +0900 | |
commit | 39191aaa6cf9f9d164c995e580c7df418b59b5c9 (patch) | |
tree | 6c6b05033b1bd63a8d95be2dc2ed30f6bb16f852 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java | |
parent | a96a3e49cd472aa902c22143358b87562603d47c (diff) |
FIX TO USE TRY WITH RESOURCES
FIX SONAR ISSUES RELATED WITH USE OF TRY
WITH RESOURCES INSTEAD OF JUST TRY
Issue-ID: PORTAL-336
Change-Id: I143c3d6167b101e5113faa3c70f57bfb8638e8de
Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java index b3ec072d..d56391ef 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java @@ -1223,16 +1223,19 @@ public class ReportSchedule extends RaptorObject implements Serializable{ int len = 0; char[] buffer = new char[512]; - Reader in = null; - in = new InputStreamReader(clob.getAsciiStream()); - // if(obj instanceof oracle.sql.CLOB) { - // in = ((oracle.sql.CLOB) obj).getCharacterStream(); - // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) { - // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream(); - // } + try(Reader in = new InputStreamReader(clob.getAsciiStream())) { + // if(obj instanceof oracle.sql.CLOB) { + // in = ((oracle.sql.CLOB) obj).getCharacterStream(); + // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) { + // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream(); + // } while ((len = in.read(buffer)) != -1) sb.append(buffer, 0, len); - in.close(); + } catch(Exception e) { + //if any error while operating the input stream, just throw the error out + //so that outer try/catch block could handle it + throw e; + } } else if (Globals.isPostgreSQL() || Globals.isMySQL()) { String clob= null; Object obj = null; |