X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fmusic%2Fconductor%2Fconditionals%2FMusicConditional.java;h=69ccd104e14c5cbc5519b7c3bfe41effa6a595c0;hb=0a358ea9fd56796d7dcf9c2a50df82a4f05b9738;hp=ff77bfde4a82f3dad1b6d825535d38129d9285b6;hpb=2357dbf628ddf889b7a1640ccb11a424f6a7dacd;p=music.git 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 ff77bfde..69ccd104 100644 --- a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java +++ b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java @@ -3,7 +3,9 @@ * org.onap.music * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property + * =================================================================== * Modifications Copyright (C) 2019 IBM. + * Modifications Copyright (c) 2019 Samsung * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,6 +114,7 @@ public class MusicConditional { return lockAcqResult; } } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, e); MusicCore.destroyLockRef(lockId); return new ReturnType(ResultType.FAILURE, e.getMessage()); } @@ -130,6 +133,7 @@ public class MusicConditional { try { results = MusicDataStoreHandle.getDSHandle().executeQuorumConsistencyGet(queryBank.get(MusicUtil.SELECT)); } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, e.getMessage()); } if (results.all().isEmpty()) { @@ -148,6 +152,7 @@ public class MusicConditional { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, "Exception thrown while doing the critical put, check sanctity of the row/conditions:\n" + exceptionAsString); @@ -175,6 +180,7 @@ public class MusicConditional { } catch (Exception e) { MusicCore.destroyLockRef(lockId); + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, e.getMessage()); } @@ -202,6 +208,7 @@ public class MusicConditional { try { MusicDataStoreHandle.getDSHandle().executePut(update, "critical"); } catch (Exception ex) { + logger.error(EELFLoggerDelegate.applicationLogger, ex); return new ReturnType(ResultType.FAILURE, ex.getMessage()); } }else { @@ -219,6 +226,7 @@ public class MusicConditional { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, "Exception thrown while doing the critical put, check sanctity of the row/conditions:\n" + exceptionAsString); @@ -254,6 +262,7 @@ public class MusicConditional { StringBuilder fieldsString = new StringBuilder("(vector_ts"+","); StringBuilder valueString = new StringBuilder("(" + "?" + ","); String vector = String.valueOf(Thread.currentThread().getId() + System.currentTimeMillis()); + String localPrimaryKey; queryObject.addValue(vector); if(casscadeColumn!=null && casscadeColumnValues!=null) { fieldsString.append(casscadeColumn).append(" ,"); @@ -267,14 +276,15 @@ public class MusicConditional { fieldsString.append(entry.getKey()); Object valueObj = entry.getValue(); if (primaryKeyName.equals(entry.getKey())) { - primaryKey = entry.getValue() + ""; - primaryKey = primaryKey.replace("'", "''"); + localPrimaryKey = entry.getValue() + ""; + localPrimaryKey = localPrimaryKey.replace("'", "''"); } DataType colType = null; try { colType = tableInfo.getColumn(entry.getKey()).getType(); } catch(NullPointerException ex) { - logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage() +" Invalid column name : "+entry.getKey(), AppMessages.INCORRECTDATA ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR); + logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage() +" Invalid column name : "+entry.getKey + (), AppMessages.INCORRECTDATA ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR, ex); } @@ -282,7 +292,7 @@ public class MusicConditional { try { formattedValue = MusicUtil.convertToActualDataType(colType, valueObj); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger,e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e); } valueString.append("?");