diff options
7 files changed, 12 insertions, 27 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/MusicDataStore.java index 7557247d..21b0053f 100644 --- a/src/main/java/org/onap/music/datastore/MusicDataStore.java +++ b/src/main/java/org/onap/music/datastore/MusicDataStore.java @@ -315,7 +315,7 @@ public class MusicDataStore { DataType colType = colInfo.getType(colName); Object columnValue = getColValue(row, colName, colType); Object conditionValue = MusicUtil.convertToActualDataType(colType, entry.getValue()); - if (columnValue.equals(conditionValue) == false) + if (columnValue.equals(conditionValue)) return false; } return true; 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/CronJobManager.java b/src/main/java/org/onap/music/main/CronJobManager.java index 0344c4a1..4928044e 100644 --- a/src/main/java/org/onap/music/main/CronJobManager.java +++ b/src/main/java/org/onap/music/main/CronJobManager.java @@ -33,6 +33,9 @@ import javax.servlet.annotation.WebListener; import org.onap.music.datastore.PreparedQueryObject; 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.MusicLockingException; import org.onap.music.exceptions.MusicServiceException; @@ -55,7 +58,7 @@ public class CronJobManager implements ServletContextListener { try { ResultType result = MusicCore.nonKeyRelatedPut(pQuery, consistency); } catch (MusicServiceException e1) { - e1.printStackTrace(); + logger.error(EELFLoggerDelegate.errorLogger, e1.getMessage(),ErrorSeverity.ERROR); } //Zookeeper cleanup @@ -102,7 +105,7 @@ public class CronJobManager implements ServletContextListener { CachingUtil.deleteKeysFromDB(deleteKeys.toString()); } } catch (MusicServiceException e) { - e.printStackTrace(); + logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),ErrorSeverity.ERROR); } } diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java index aaaeae34..9f7b060b 100644 --- a/src/main/java/org/onap/music/main/MusicCore.java +++ b/src/main/java/org/onap/music/main/MusicCore.java @@ -125,7 +125,7 @@ public class MusicCore { long start = System.currentTimeMillis(); if (mDstoreHandle == null) { // Quick Fix - Best to put this into every call to getDSHandle? - if (! MusicUtil.getMyCassaHost().equals("localhost") ) { + if (! "localhost".equals(MusicUtil.getMyCassaHost())) { mDstoreHandle = new MusicDataStore(MusicUtil.getMyCassaHost()); } else { mDstoreHandle = new MusicDataStore(); diff --git a/src/main/java/org/onap/music/main/MusicUtil.java b/src/main/java/org/onap/music/main/MusicUtil.java index 5b23a935..cfad845d 100755 --- a/src/main/java/org/onap/music/main/MusicUtil.java +++ b/src/main/java/org/onap/music/main/MusicUtil.java @@ -101,7 +101,7 @@ public class MusicUtil { private static String cassName = "cassandra"; private static String cassPwd; private static String aafEndpointUrl = null; - public static ConcurrentMap<String, Long> zkNodeMap = new ConcurrentHashMap<>(); + public static final ConcurrentMap<String, Long> zkNodeMap = new ConcurrentHashMap<>(); private MusicUtil() { throw new IllegalStateException("Utility Class"); @@ -599,7 +599,7 @@ public class MusicUtil { try { input.close(); } catch (IOException e) { - e.printStackTrace(); + logger.error(EELFLoggerDelegate.applicationLogger,"Load properties failed "+e.getMessage(),e); } } } diff --git a/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java b/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java index 937ec77a..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; diff --git a/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java b/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java index a5f2ac49..b9754f61 100644 --- a/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java +++ b/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java @@ -35,9 +35,6 @@ import org.onap.music.eelf.logging.EELFLoggerDelegate; import org.onap.music.main.MusicUtil; import org.onap.music.main.ResultType; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; |