diff options
author | 2019-12-10 17:05:21 +0900 | |
---|---|---|
committer | 2020-01-23 16:57:50 +0900 | |
commit | a231d482351c64dc35563821d9531981ba28d4f3 (patch) | |
tree | 66fded7d469f82b3ed57dfc3b7fd307d6fe6934a /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java | |
parent | 28af72fc23a1e0cb67e1ac1b5fac6b6d9020270a (diff) |
Fix NullPointerException & other sonar issues
A "NullPointerException" could be thrown
Use a logger to log this exception
Cast one of the operands of this multiplication operation to a "long"
Use isEmpty() to check whether the collection is empty or not
Issue-ID: PORTAL-562
Change-Id: I1bc657a8893379329547b131b53e37da873d55db
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java index 04e237ae..86f2d912 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java @@ -59,7 +59,7 @@ public class Scheduler extends TimerTask { public void start() { if (timeInterval > 0) - timer.schedule(this, 0, timeInterval * 1000); + timer.schedule(this, 0, timeInterval * 1000L); } public void stop() { @@ -92,18 +92,18 @@ public class Scheduler extends TimerTask { sendNotifications.send_notification(AppUtils.getSMTPServer(), AppUtils.getSMTPServer(), Globals.getSystemName() , AppUtils.getDirectAccessURL(), timeInterval); - } catch (Exception e) { - Log.write("[SYSTEM ERROR Scheduler.run] Exception: " + e.getMessage()); - //e.printStackTrace(); - } - finally { - - try { - sendNotifications.deInit(); - } catch (SQLException e) { - Log.write("[SYSTEM ERROR Scheduler.run] Could not close connection: " + e.getMessage()); - } - } + } catch (Exception e) { + Log.write("[SYSTEM ERROR Scheduler.run] Exception: " + e.getMessage()); + } finally { + try { + if (sendNotifications != null) { + sendNotifications.deInit(); + } + } catch (SQLException e) { + Log.write("[SYSTEM ERROR Scheduler.run] Could not close connection: " + + e.getMessage()); + } + } } // run } // Scheduler |