I fixed the sonar blocker in regards to nullPointerException and few
other majors that I found and were easy to fix. I ran my local sonar
and the blocker was removed after the changes.
Change-Id: I7dcd7584fc955e1b520235a8e1376cf871761d21
Issue-ID: POLICY-776
Signed-off-by: Michael Mokry <mm117s@att.com>
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
logger.info(mainObject);
logger.info("###############################################################################");
}
logger.info(mainObject);
logger.info("###############################################################################");
}
LinkedHashMap<String,String> parseDataNodes(LinkedHashMap<String,String> map){
LinkedHashMap<String,String> dataMapForJson=new LinkedHashMap <>();
matchableValues = new HashMap <>();
LinkedHashMap<String,String> parseDataNodes(LinkedHashMap<String,String> map){
LinkedHashMap<String,String> dataMapForJson=new LinkedHashMap <>();
matchableValues = new HashMap <>();
else{
StringBuilder stringListItems= new StringBuilder();
if(LIST.equalsIgnoreCase(typeValue)){
else{
StringBuilder stringListItems= new StringBuilder();
if(LIST.equalsIgnoreCase(typeValue)){
- stringListItems.append(uniqueDataKeySplit[1].toUpperCase()+":required-"+requiredValue +":MANY-false");
+ stringListItems.append(uniqueDataKeySplit[1].toUpperCase()+REQUIREDVALUE+requiredValue +MANYFALSE);
}else if( MAP.equalsIgnoreCase(typeValue)){
}else if( MAP.equalsIgnoreCase(typeValue)){
- stringListItems.append(uniqueDataKeySplit[1].toUpperCase()+":required-"+requiredValue +":MANY-true");
+ stringListItems.append(uniqueDataKeySplit[1].toUpperCase()+REQUIREDVALUE+requiredValue +MANYTRUE);
}
dataMapForJson.put(uniqueDataKey, stringListItems.toString());
boolean isConstraintsFound = false;
}
dataMapForJson.put(uniqueDataKey, stringListItems.toString());
boolean isConstraintsFound = false;
logger.info("findConstraints => " + findConstraints);
String constraintsValue=map.get(findConstraints);
logger.info("constraintsValue => " + constraintsValue);
logger.info("findConstraints => " + findConstraints);
String constraintsValue=map.get(findConstraints);
logger.info("constraintsValue => " + constraintsValue);
- if((constraintsValue==null || constraintsValue.isEmpty()) && i==0){ //if no constraints at all ( index i as 0 can tell this )
+
+ if((constraintsValue==null || constraintsValue.isEmpty()) && i==0){ //if no constraints at all ( index i as 0 can tell this )
isConstraintsFound = false;
//if type is list but no constraints
String newValue = dataMapForJson.get(uniqueDataKey).replace("MANY-false", "MANY-true");
isConstraintsFound = false;
//if type is list but no constraints
String newValue = dataMapForJson.get(uniqueDataKey).replace("MANY-false", "MANY-true");
if(i == 0){ // only need to add one time for the same attribute
dataListBuffer.append(uniqueDataKeySplit[1].toUpperCase()+"=[");
}
if(i == 0){ // only need to add one time for the same attribute
dataListBuffer.append(uniqueDataKeySplit[1].toUpperCase()+"=[");
}
-
- if(constraintsValue.contains("=")){
+
+ if(constraintsValue==null){
+ constraintsValue = "";
+ }else if (constraintsValue.contains("=")) {
constraintsValue = constraintsValue.replace("=", "equal-sign");
}
constraintsValue = constraintsValue.replace("=", "equal-sign");
}
dataConstraints.add(constraintsValue);
dataListBuffer.append(constraintsValue+",");
}
dataConstraints.add(constraintsValue);
dataListBuffer.append(constraintsValue+",");
}