From 35c04a15d76d002d5cbc719dc855a15c4a84b962 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Fri, 15 Sep 2017 17:05:44 -0400 Subject: Fix sonar critical Last transient/serializable issues. Throw a dedicated exception for DateUtil class Unused imports Make the enclosing method "static" or remove this set. Issue-ID: POLICY-115 Change-Id: I366f85922c4d4d290b320e0b88678c805de59872 Signed-off-by: Pamela Dragosh --- .../java/org/onap/policy/guard/PIPEngineGetHistory.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'controlloop/common/guard') diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java index afb847e09..9ee6f2310 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PIPEngineGetHistory.java @@ -59,9 +59,19 @@ import com.att.research.xacml.std.pip.engines.StdConfigurableEngine; public class PIPEngineGetHistory extends StdConfigurableEngine{ + private interface DateUtil{ + public class DateUtilException extends Exception { + private static final long serialVersionUID = 2612662650481443076L; + + public DateUtilException(String message) { + super(message); + } + + } + public long getMs(); - public DateUtil init(String sqlValUnit) throws Exception; + public DateUtil init(String sqlValUnit) throws DateUtilException; } private static final Logger logger = LoggerFactory.getLogger(PIPEngineGetHistory.class); @@ -338,10 +348,10 @@ public class PIPEngineGetHistory extends StdConfigurableEngine{ private double multiplier = 0; @Override - public DateUtil init(String sqlValUnit) throws Exception{ + public DateUtil init(String sqlValUnit) throws DateUtilException{ String[] split = sqlValUnit.split(" "); if(split.length != 2){ - throw new Exception("Invalid Value Unit pair for SQL"); + throw new DateUtilException("Invalid Value Unit pair for SQL"); } ms = Long.parseLong(split[0]); -- cgit 1.2.3-korg