diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2019-01-11 22:46:16 +0530 |
---|---|---|
committer | Sandeep J <sandeejh@in.ibm.com> | 2019-01-11 22:46:22 +0530 |
commit | 61ae7a6452c7ef1a0348f9fde43cc5391b52146c (patch) | |
tree | 09d8d620a3c3f34bad1aed84e4c3a5b5bce33fa8 | |
parent | 366337b206ee8fbc0da8fcabc44ca2f34ccaeab9 (diff) |
fixed sonar issue in RestMusicDataAPI
fixed sonar issue
Issue-ID: MUSIC-212
Change-Id: I130cf5e79a1f15fddd681d66c28eb4504e48fa5e
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rwxr-xr-x | src/main/java/org/onap/music/rest/RestMusicDataAPI.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/org/onap/music/rest/RestMusicDataAPI.java b/src/main/java/org/onap/music/rest/RestMusicDataAPI.java index 592b744b..a8fd1fc2 100755 --- a/src/main/java/org/onap/music/rest/RestMusicDataAPI.java +++ b/src/main/java/org/onap/music/rest/RestMusicDataAPI.java @@ -397,10 +397,9 @@ public class RestMusicDataAPI { if (counter != (fields.size() - 1) ) { - //logger.info("cjc2 field="+entry.getValue()+"counter=" + counter+"fieldsize-1="+(fields.size() -1) + ","); counter = counter + 1; } else { - //logger.info("cjc3 field="+entry.getValue()+"counter=" + counter+"fieldsize="+fields.size() + ","); + if((primaryKey != null) && (partitionKey == null)) { primaryKey.trim(); int count1 = StringUtils.countMatches(primaryKey, ')'); @@ -454,7 +453,7 @@ public class RestMusicDataAPI { else if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey + ")"; else primaryKey=" (" + partitionKey + ")," + clusterKey; - //if (primaryKey != null) fieldsString.append("" + entry.getKey() + " (" + primaryKey + " )"); + if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )"); } // end of length > 0 @@ -473,7 +472,7 @@ public class RestMusicDataAPI { else if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey + ")"; else primaryKey=" (" + partitionKey + ")," + clusterKey; - //if (primaryKey != null) fieldsString.append("" + entry.getKey() + " (" + primaryKey + " )"); + if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )"); } fieldsString.append(")"); @@ -515,9 +514,7 @@ public class RestMusicDataAPI { String[] clusterS = arrayClusterOrder[i].trim().split("[ ]+"); if ( (clusterS.length ==2) && (clusterS[1].equalsIgnoreCase("ASC") || clusterS[1].equalsIgnoreCase("DESC"))) continue; else { - //logger.error("createTable/Clustering Order vlaue ERROR: valid clustering order is ASC or DESC or expecting colname order; please correct clusteringOrder:\"+ clusteringOrder+\".\"", " valid clustering order is ASC or DESC; please correct clusteringOrder:"+ clusteringOrder+"."); - // logger.error(EELFLoggerDelegate.errorLogger, "", AppMessages.MISSINGDATA, - // ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR); + return response.status(Status.BAD_REQUEST) .entity(new JsonResponse(ResultType.FAILURE) .setError("createTable/Clustering Order vlaue ERROR: valid clustering order is ASC or DESC or expecting colname order; please correct clusteringOrder:"+ clusteringOrder+".") |