From 3b9fd0933fcda7b4f85aff70fc72ffd517e5b30f Mon Sep 17 00:00:00 2001 From: libujacob Date: Fri, 5 Jan 2018 11:21:45 +0530 Subject: Modifier corrections for instance variables Removed toString() method for string datatypes Issue-ID: DCAEGEN2-207 Change-Id: I24d45fa312808333df7c42b85c277baa708bfa35 Signed-off-by: libujacob --- .../onap/dcae/commonFunction/CommonStartup.java | 23 +++++++++++----------- .../onap/dcae/restapi/RestfulCollectorServlet.java | 2 +- .../onap/dcae/restapi/endpoints/EventReceipt.java | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java b/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java index 55a83f7d..b4fae2a6 100644 --- a/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java +++ b/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java @@ -81,7 +81,7 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { public static final String KDEFAULT_KEYALIAS = "tomcat"; public static final String KSETTING_DMAAPCONFIGS = "collector.dmaapfile"; - protected static final String[] KDEFAULT_DMAAPCONFIGS = new String[] { "/etc/DmaapConfig.json" }; + private static final String[] KDEFAULT_DMAAPCONFIGS = new String[] { "/etc/DmaapConfig.json" }; public static final String KSETTING_MAXQUEUEDEVENTS = "collector.inputQueue.maxPending"; public static final int KDEFAULT_MAXQUEUEDEVENTS = 1024 * 4; @@ -98,7 +98,7 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { public static final String KSETTING_AUTHFLAG = "header.authflag"; public static final int KDEFAULT_AUTHFLAG = 0; - public static final String kSetting_authlist = "header.authlist"; + public static final String KSETTING_AUTHLIST = "header.authlist"; public static final String KSETTING_EVENTTRANSFORMFLAG = "event.transform.flag"; public static final int KDEFAULT_EVENTTRANSFORMFLAG = 1; @@ -108,7 +108,7 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { public static final Logger eplog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.error"); public static final Logger metriclog = LoggerFactory.getLogger("com.att.ecomp.metrics"); - public static int schema_Validatorflag = -1; + public static int schemaValidatorflag = -1; public static int authflag = 1; public static int eventTransformFlag = 1; public static String schemaFile; @@ -118,6 +118,10 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { private boolean listnerstatus; public static String streamid; + public static LinkedBlockingQueue fProcessingInputQueue; + private static ApiServer fTomcatServer = null; + private static final Logger log = LoggerFactory.getLogger(CommonStartup.class); + private CommonStartup(rrNvReadable settings) throws loadException, IOException, rrNvReadable.missingReqdSetting, rrNvReadable.invalidSettingValue, ServletException, InterruptedException { final List connectors = new LinkedList(); @@ -143,8 +147,8 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { // Reading other config properties - schema_Validatorflag = settings.getInt(KSETTING_SCHEMAVALIDATOR, KDEFAULT_SCHEMAVALIDATOR); - if (schema_Validatorflag > 0) { + schemaValidatorflag = settings.getInt(KSETTING_SCHEMAVALIDATOR, KDEFAULT_SCHEMAVALIDATOR); + if (schemaValidatorflag > 0) { schemaFile = settings.getString(KSETTING_SCHEMAFILE, KDEFAULT_SCHEMAFILE); // System.out.println("SchemaFile:" + schemaFile); schemaFileJson = new JSONObject(schemaFile); @@ -280,14 +284,14 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { report = schema.validate(data); } catch (JsonParseException e) { log.error("schemavalidate:JsonParseException for event:" + jsonData); - return e.getMessage().toString(); + return e.getMessage(); } catch (ProcessingException e) { log.error("schemavalidate:Processing exception for event:" + jsonData); - return e.getMessage().toString(); + return e.getMessage(); } catch (IOException e) { log.error( "schemavalidate:IO exception; something went wrong trying to read json data for event:" + jsonData); - return e.getMessage().toString(); + return e.getMessage(); } if (report != null) { Iterator iter = report.iterator(); @@ -305,8 +309,5 @@ public class CommonStartup extends NsaBaseEndpoint implements Runnable { return result; } - public static LinkedBlockingQueue fProcessingInputQueue; - private static ApiServer fTomcatServer = null; - private static final Logger log = LoggerFactory.getLogger(CommonStartup.class); } diff --git a/src/main/java/org/onap/dcae/restapi/RestfulCollectorServlet.java b/src/main/java/org/onap/dcae/restapi/RestfulCollectorServlet.java index c18901dc..1fa3c419 100644 --- a/src/main/java/org/onap/dcae/restapi/RestfulCollectorServlet.java +++ b/src/main/java/org/onap/dcae/restapi/RestfulCollectorServlet.java @@ -57,7 +57,7 @@ public class RestfulCollectorServlet extends CommonServlet public RestfulCollectorServlet ( rrNvReadable settings ) throws loadException, missingReqdSetting { super ( settings, "collector", false ); - authlist = settings.getString(CommonStartup.kSetting_authlist,null); + authlist = settings.getString(CommonStartup.KSETTING_AUTHLIST,null); } diff --git a/src/main/java/org/onap/dcae/restapi/endpoints/EventReceipt.java b/src/main/java/org/onap/dcae/restapi/endpoints/EventReceipt.java index 5ee3b792..8d2ecaa1 100644 --- a/src/main/java/org/onap/dcae/restapi/endpoints/EventReceipt.java +++ b/src/main/java/org/onap/dcae/restapi/endpoints/EventReceipt.java @@ -125,7 +125,7 @@ public class EventReceipt extends NsaBaseEndpoint { } if (retkey != null || CommonStartup.authflag == 0) { - if (CommonStartup.schema_Validatorflag > 0) { + if (CommonStartup.schemaValidatorflag > 0) { if ((arrayFlag == 1) && (jsonObject.has("eventList") && (!jsonObject.has("event"))) || ((arrayFlag == 0) && (!jsonObject.has("eventList") && (jsonObject.has("event"))))) { fr = new FileReader(schemaFileVersion(vesVersion)); -- cgit 1.2.3-korg