summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/music/conductor/conditionals/JsonConditional.java4
-rw-r--r--src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java2
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java4
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java5
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java9
-rw-r--r--src/main/java/org/onap/music/lockingservice/MusicLockState.java5
-rw-r--r--src/main/java/org/onap/music/lockingservice/ProtocolSupport.java2
-rw-r--r--src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java4
-rwxr-xr-xsrc/main/java/org/onap/music/main/CachingUtil.java20
-rw-r--r--src/main/java/org/onap/music/main/MusicCore.java8
-rwxr-xr-xsrc/main/java/org/onap/music/rest/RestMusicAdminAPI.java20
11 files changed, 43 insertions, 40 deletions
diff --git a/src/main/java/org/onap/music/conductor/conditionals/JsonConditional.java b/src/main/java/org/onap/music/conductor/conditionals/JsonConditional.java
index 33a14bef..8cacc369 100644
--- a/src/main/java/org/onap/music/conductor/conditionals/JsonConditional.java
+++ b/src/main/java/org/onap/music/conductor/conditionals/JsonConditional.java
@@ -35,8 +35,8 @@ public class JsonConditional implements Serializable {
private String primaryKey;
private String primaryKeyValue;
private String casscadeColumnName;
- private Map<String,Object> tableValues;
- private Map<String,Object> casscadeColumnData;
+ private transient Map<String,Object> tableValues;
+ private transient Map<String,Object> casscadeColumnData;
private Map<String,Map<String,String>> conditions;
public Map<String, Object> getTableValues() {
diff --git a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java
index 0fc9ffe3..c97ccfab 100644
--- a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java
+++ b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java
@@ -335,7 +335,7 @@ public class MusicConditional {
Map<String, String> finalValues = new HashMap<>();
values = (Map<String, String>) columnValue;
- if (values.keySet().contains(planId)) {
+ if (values != null && values.keySet().contains(planId)) {
String valueString = values.get(planId);
String tempValueString = valueString.replaceAll("\\{", "").replaceAll("\"", "").replaceAll("\\}", "");
String[] elements = tempValueString.split(",");
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
index a5db4be5..ce7f509b 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
@@ -36,7 +36,8 @@ public class JsonDelete {
private ArrayList<String> columns = null;
private Map<String, String> consistencyInfo;
private Map<String, Object> conditions;
- String ttl, timestamp;
+ String ttl;
+ String timestamp;
@ApiModelProperty(value = "Conditions")
@@ -85,3 +86,4 @@ public class JsonDelete {
this.timestamp = timestamp;
}
}
+
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
index 64bc3887..ef56c5de 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
@@ -27,13 +27,13 @@ import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Map;
-
+import org.apache.log4j.Logger;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonSelect implements Serializable {
private Map<String, String> consistencyInfo;
-
+ static Logger logger = Logger.getLogger(JsonSelect.class.getName());
public Map<String, String> getConsistencyInfo() {
return consistencyInfo;
@@ -51,6 +51,7 @@ public class JsonSelect implements Serializable {
out.writeObject(this);
} catch (IOException e) {
// TODO Auto-generated catch block
+ logger.error("Error", e);
e.printStackTrace();
}
return bos.toByteArray();
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
index 3ab5ea0d..c1a56819 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
@@ -38,11 +38,12 @@ import io.swagger.annotations.ApiModelProperty;
public class JsonUpdate implements Serializable {
private String keyspaceName;
private String tableName;
- private Map<String, Object> values;
- private String ttl, timestamp;
+ private transient Map<String, Object> values;
+ private String ttl;
+ private String timestamp;
private Map<String, String> consistencyInfo;
- private Map<String, Object> conditions;
- private Map<String, Object> row_specification;
+ private transient Map<String, Object> conditions;
+ private transient Map<String, Object> row_specification;
@ApiModelProperty(value = "Conditions")
public Map<String, Object> getConditions() {
diff --git a/src/main/java/org/onap/music/lockingservice/MusicLockState.java b/src/main/java/org/onap/music/lockingservice/MusicLockState.java
index 6c31410f..04a1e6b2 100644
--- a/src/main/java/org/onap/music/lockingservice/MusicLockState.java
+++ b/src/main/java/org/onap/music/lockingservice/MusicLockState.java
@@ -44,7 +44,8 @@ public class MusicLockState implements Serializable {
LockStatus lockStatus;
boolean needToSyncQuorum = false;
String lockHolder;
- long leasePeriod = Long.MAX_VALUE, leaseStartTime = -1;
+ long leasePeriod = Long.MAX_VALUE;
+ long leaseStartTime = -1;
private String errorMessage = null;
@@ -117,6 +118,7 @@ public class MusicLockState implements Serializable {
out = new ObjectOutputStream(bos);
out.writeObject(this);
} catch (IOException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
}
return bos.toByteArray();
@@ -130,6 +132,7 @@ public class MusicLockState implements Serializable {
in = new ObjectInputStream(bis);
o = in.readObject();
} catch (ClassNotFoundException | IOException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
}
return (MusicLockState) o;
diff --git a/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java b/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java
index 4082b3b8..19f49beb 100644
--- a/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java
+++ b/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java
@@ -174,8 +174,10 @@ class ProtocolSupport {
}
});
} catch (KeeperException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
} catch (InterruptedException e) {
+ logger.error("Error", e);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
}
diff --git a/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java b/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
index 5f9c07ee..b09668b7 100644
--- a/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
+++ b/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
@@ -298,7 +298,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
try {
stat = zookeeper.exists(id, false);
} catch (KeeperException | InterruptedException e1) {
- e1.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, "Error in execute: " + e1);
}
Long ctime = stat.getCtime();
MusicUtil.zkNodeMap.put(id, ctime);
@@ -310,7 +310,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
pQuery.addValue(MusicUtil.convertToActualDataType(DataType.text(), ctime));
MusicCore.eventualPut(pQuery);
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, "Error in execute: " + e);
}
break;
}
diff --git a/src/main/java/org/onap/music/main/CachingUtil.java b/src/main/java/org/onap/music/main/CachingUtil.java
index a4366836..34bc52d3 100755
--- a/src/main/java/org/onap/music/main/CachingUtil.java
+++ b/src/main/java/org/onap/music/main/CachingUtil.java
@@ -21,31 +21,24 @@
*/
package org.onap.music.main;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.jcs.JCS;
import org.apache.commons.jcs.access.CacheAccess;
-import org.codehaus.jackson.map.ObjectMapper;
import org.mindrot.jbcrypt.BCrypt;
import org.onap.music.datastore.PreparedQueryObject;
-import org.onap.music.datastore.jsonobjects.AAFResponse;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
import org.onap.music.eelf.logging.format.AppMessages;
import org.onap.music.eelf.logging.format.ErrorSeverity;
import org.onap.music.eelf.logging.format.ErrorTypes;
import org.onap.music.exceptions.MusicServiceException;
-import org.onap.music.datastore.jsonobjects.JsonNotification;
import org.onap.music.datastore.jsonobjects.JsonCallback;
-import com.att.eelf.configuration.EELFLogger;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
@@ -112,7 +105,6 @@ public class CachingUtil implements Runnable {
pQuery.addValue(MusicUtil.convertToActualDataType(DataType.cboolean(), false));
} catch (Exception e1) {
logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(),AppMessages.CACHEERROR, ErrorSeverity.CRITICAL, ErrorTypes.GENERALSERVICEERROR);
- e1.printStackTrace();
}
ResultSet rs = MusicCore.get(pQuery);
Iterator<Row> it = rs.iterator();
@@ -137,7 +129,6 @@ public class CachingUtil implements Runnable {
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.INFO, ErrorTypes.GENERALSERVICEERROR);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Something at AAF was changed for ns: " + nameSpace+" So not updating Cache for the namespace. ");
- e.printStackTrace();
}
}
@@ -279,7 +270,6 @@ public class CachingUtil implements Runnable {
appNameCache.put(namespace, isAAF);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR,ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- e.printStackTrace();
}
}
return isAAF;
@@ -297,7 +287,6 @@ public class CachingUtil implements Runnable {
uuid = rs.getUUID("uuid").toString();
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger,"Exception occured during uuid retrieval from DB."+e.getMessage());
- e.printStackTrace();
}
}
return uuid;
@@ -314,7 +303,6 @@ public class CachingUtil implements Runnable {
appName = rs.getString("application_name");
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- e.printStackTrace();
}
return appName;
}
@@ -361,7 +349,6 @@ public class CachingUtil implements Runnable {
rs = MusicCore.get(queryObject).one();
} catch (MusicServiceException e) {
// TODO Auto-generated catch block
- e.printStackTrace();
resultMap.put("Exception", "Unable to process operation. Error is "+e.getMessage());
return resultMap;
} catch (InvalidQueryException e) {
@@ -405,14 +392,13 @@ public class CachingUtil implements Runnable {
try {
queryObject.addValue(MusicUtil.convertToActualDataType(DataType.text(), keyspace));
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.AUTHENTICATIONERROR, ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
}
Row rs = null;
try {
rs = MusicCore.get(queryObject).one();
} catch (MusicServiceException e) {
- e.printStackTrace();
- resultMap.put("Exception", "Unable to process operation. Error is "+e.getMessage());
+ resultMap.put("Exception", "Unable to process operation. Error is "+e.getMessage());
return resultMap;
}
if(rs == null) {
@@ -448,7 +434,7 @@ public class CachingUtil implements Runnable {
try {
MusicCore.nonKeyRelatedPut(pQuery, "eventual");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.AUTHENTICATIONERROR, "Error in deleteKeysFromDB");
}
}
}
diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java
index b729ba74..aaaeae34 100644
--- a/src/main/java/org/onap/music/main/MusicCore.java
+++ b/src/main/java/org/onap/music/main/MusicCore.java
@@ -73,7 +73,10 @@ public class MusicCore {
public boolean testCondition() throws Exception {
// first generate the row
ResultSet results = quorumGet(selectQueryForTheRow);
- Row row = results.one();
+ Row row = null;
+ if(results != null) {
+ row = results.one();
+ }
return getDSHandle().doesRowSatisfyCondition(row, conditions);
}
}
@@ -288,7 +291,8 @@ public class MusicCore {
MusicLockState newMls = null;
try {
currentMls = getMusicLockState(key);
- String currentLockHolder = currentMls.getLockHolder();
+ String currentLockHolder = null;
+ if(currentMls != null) { currentLockHolder = currentMls.getLockHolder(); };
if (lockId.equals(currentLockHolder)) {
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: You already have the lock!");
return new ReturnType(ResultType.SUCCESS, "You already have the lock!");
diff --git a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
index 48f28f8c..f28f236f 100755
--- a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
+++ b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
@@ -22,7 +22,6 @@
package org.onap.music.rest;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -506,19 +505,24 @@ public class RestMusicAdminAPI {
logger.info(operation+ ": Operation :: changeValue: "+changeValueMap);
if(operation.equals("update")) {
String notifyWhenChangeIn = baseRequestObj.getNotifyWhenChangeIn(); // conductor.plans.status
- if(field_value.equals(notifyWhenChangeIn)) {
- notifyCallBackAppl(jsonResponse, baseRequestObj);
+ if(null!=field_value) {
+ if(field_value.equals(notifyWhenChangeIn)) {
+ notifyCallBackAppl(jsonResponse, baseRequestObj);
+ }
}
-
} else if(operation.equals("delete")) {
String notifyWhenDeletesIn = baseRequestObj.getNotifyWhenDeletesIn(); // conductor.plans.status
- if(field_value.equals(notifyWhenDeletesIn)) {
- notifyCallBackAppl(jsonResponse, baseRequestObj);
+ if(null!=field_value) {
+ if(field_value.equals(notifyWhenDeletesIn)) {
+ notifyCallBackAppl(jsonResponse, baseRequestObj);
+ }
}
} else if(operation.equals("insert")) {
String notifyWhenInsertsIn = baseRequestObj.getNotifyWhenInsertsIn(); // conductor.plans.status
- if(field_value.equals(notifyWhenInsertsIn)) {
- notifyCallBackAppl(jsonResponse, baseRequestObj);
+ if(null!=field_value) {
+ if(field_value.equals(notifyWhenInsertsIn)) {
+ notifyCallBackAppl(jsonResponse, baseRequestObj);
+ }
}
}
MusicCore.releaseLock(lockId, true);