summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-09-19 18:31:16 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-19 18:31:16 +0000
commit2fa0b149b9eb63230c48ed80f7966603acec0401 (patch)
tree8caa795a0ed46a378477141cfac2da604eb5e135
parent207c9a6e9d1dfa8153fe82a815c7044873cc1bc2 (diff)
parenta74b012e58223276e9903db3b0905ba72e4cb259 (diff)
Merge "Fix few Major sonar issues"
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java92
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java6
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java14
3 files changed, 56 insertions, 56 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java
index 5e19a52c..b9ad19e2 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicAtom.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@
package org.onap.ccsdk.sli.core.sli;
public class SvcLogicAtom extends SvcLogicExpression {
-
+
public enum AtomType {
NUMBER,
STRING,
@@ -30,7 +30,7 @@ public class SvcLogicAtom extends SvcLogicExpression {
CONTEXT_VAR
}
-
+
private AtomType atomType;
private String atom;
@@ -39,9 +39,9 @@ public class SvcLogicAtom extends SvcLogicExpression {
{
this.atomType = AtomType.valueOf(atomType);
this.atom = atom;
-
+
}
-
+
public SvcLogicAtom(String atom)
{
@@ -73,9 +73,9 @@ public class SvcLogicAtom extends SvcLogicExpression {
{
this.atomType = AtomType.IDENTIFIER;
this.atom = atom;
-
+
}
-
+
}
}
}
@@ -83,7 +83,7 @@ public class SvcLogicAtom extends SvcLogicExpression {
public AtomType getAtomType() {
return atomType;
}
-
+
public void setAtomType(String newType)
{
atomType = AtomType.valueOf(newType);
@@ -92,9 +92,9 @@ public class SvcLogicAtom extends SvcLogicExpression {
public String getAtom() {
return atom;
}
-
-
-
+
+
+
public void setAtomType(AtomType atomType) {
this.atomType = atomType;
}
@@ -110,27 +110,27 @@ public class SvcLogicAtom extends SvcLogicExpression {
StringBuffer sbuff = new StringBuffer();
switch(getAtomType())
{
- case CONTEXT_VAR:
- sbuff.append("$");
- case IDENTIFIER:
- boolean needDot = false;
- for (SvcLogicExpression term: this.getOperands())
- {
- if (needDot)
+ case CONTEXT_VAR:
+ sbuff.append("$");
+ case IDENTIFIER:
+ boolean needDot = false;
+ for (SvcLogicExpression term: this.getOperands())
{
- sbuff.append(".");
+ if (needDot)
+ {
+ sbuff.append(".");
+ }
+ sbuff.append(term.toString());
+ needDot = true;
}
- sbuff.append(term.toString());
- needDot = true;
- }
- return(sbuff.toString());
- case STRING:
- case NUMBER:
- default:
- return(atom);
+ return sbuff.toString();
+ case STRING:
+ case NUMBER:
+ default:
+ return atom;
}
}
-
+
public String asParsedExpr()
{
// simplify debugging output for NUMBER type
@@ -139,32 +139,32 @@ public class SvcLogicAtom extends SvcLogicExpression {
}
StringBuffer sbuff = new StringBuffer();
-
+
sbuff.append("(atom");
sbuff.append("<");
sbuff.append(atomType.toString());
sbuff.append(">");
-
+
switch(atomType)
{
- case IDENTIFIER:
- case CONTEXT_VAR:
- for (SvcLogicExpression term : getOperands())
- {
+ case IDENTIFIER:
+ case CONTEXT_VAR:
+ for (SvcLogicExpression term : getOperands())
+ {
+ sbuff.append(" ");
+ sbuff.append(term.asParsedExpr());
+
+ }
+ break;
+ default:
sbuff.append(" ");
- sbuff.append(term.asParsedExpr());
-
- }
- break;
- default:
- sbuff.append(" ");
- sbuff.append(atom);
+ sbuff.append(atom);
}
-
+
sbuff.append(")");
- return(sbuff.toString());
+ return sbuff.toString();
}
-
-
+
+
}
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
index 23277439..aca904d1 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
@@ -212,7 +212,7 @@ public class SvcLogicContext {
if (ctxVarName.indexOf('[') == -1) {
// Ctx variable contains no arrays
- return (this.getAttribute(ctxVarName));
+ return getAttribute(ctxVarName);
}
// Resolve any array references
@@ -225,7 +225,7 @@ public class SvcLogicContext {
if (endBracketLoc == -1) {
// Missing end bracket ... give up parsing
LOG.warn("Variable reference {} seems to be missing a ']'", ctxVarName);
- return (this.getAttribute(ctxVarName));
+ return getAttribute(ctxVarName);
}
String idxVarName = ctxVarParts[i].substring(1, endBracketLoc);
@@ -242,7 +242,7 @@ public class SvcLogicContext {
}
}
- return (this.getAttribute(sbuff.toString()));
+ return getAttribute(sbuff.toString());
}
}
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java
index 11b5fdea..532ad31b 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@ public class SvcLogicStoreFactory {
}
try {
- return (getSvcLogicStore(new FileInputStream(propFile)));
+ return getSvcLogicStore(new FileInputStream(propFile));
} catch (Exception e) {
throw new ConfigurationException(
"Could load service store from properties file " + propfile,
@@ -62,7 +62,7 @@ public class SvcLogicStoreFactory {
throw new ConfigurationException("Could not get load properties from input stream", e);
}
- return(getSvcLogicStore(props));
+ return getSvcLogicStore(props);
}
public static SvcLogicStore getSvcLogicStore(Properties props)
@@ -74,8 +74,8 @@ public class SvcLogicStoreFactory {
}
- SvcLogicStore retval = null;
- LOG.debug(String.format("Using org.onap.ccsdk.sli.dbtype=%s", storeType));
+ SvcLogicStore retval;
+ LOG.debug("Using org.onap.ccsdk.sli.dbtype={}", storeType);
if ("jdbc".equalsIgnoreCase(storeType)) {
retval = new SvcLogicJdbcStore();
@@ -90,7 +90,7 @@ public class SvcLogicStoreFactory {
retval.init(props);
- return (retval);
+ return retval;
}
}