diff options
9 files changed, 58 insertions, 57 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java index 7574841..66cfc3a 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java @@ -164,7 +164,7 @@ public class MdbcConnection implements Connection { } catch (MDBCServiceException e) { // TODO Auto-generated catch block logger.error("Cannot commit log to music" + e.getStackTrace()); - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } } if(progressKeeper!=null) { @@ -206,7 +206,7 @@ public class MdbcConnection implements Connection { } catch (MDBCServiceException e) { //If the commit fail, then a new commitId should be used logger.error(EELFLoggerDelegate.errorLogger, "Commit to music failed", AppMessages.UNKNOWNERROR, ErrorTypes.UNKNOWN, ErrorSeverity.FATAL); - throw new SQLException("Failure commiting to MUSIC"); + throw new SQLException("Failure commiting to MUSIC", e); } if(progressKeeper != null) { @@ -529,7 +529,7 @@ public class MdbcConnection implements Connection { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR); //logger.error(EELFLoggerDelegate.errorLogger, "Exception synchronizeTables: "+e); - throw new QueryException(); + throw new QueryException(e); } } } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcPreparedStatement.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcPreparedStatement.java index 68a40a8..1913811 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcPreparedStatement.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcPreparedStatement.java @@ -100,7 +100,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return r; } @@ -121,7 +121,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -211,7 +211,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat throw e; } } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -318,7 +318,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -338,7 +338,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -358,7 +358,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -378,7 +378,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -398,7 +398,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -418,7 +418,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -469,7 +469,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } @@ -492,7 +492,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -621,7 +621,7 @@ public class MdbcPreparedStatement extends MdbcStatement implements PreparedStat throw e; } } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java index a70c359..b2ca073 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServerLogic.java @@ -151,7 +151,7 @@ public class MdbcServerLogic extends JdbcMeta{ conn.close(); } catch (SQLException e) { logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR, ErrorTypes.QUERYERROR, ErrorSeverity.CRITICAL); - throw new RuntimeException(e.getMessage()); + throw new RuntimeException(e.getMessage(), e); } finally { connectionCache.invalidate(ch.id); this.manager.closeConnection(ch.id); diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcStatement.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcStatement.java index 26b9acd..8afcca6 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcStatement.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcStatement.java @@ -84,7 +84,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return r; } @@ -105,7 +105,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -197,7 +197,7 @@ public class MdbcStatement implements Statement { throw e; } } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -304,7 +304,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -324,7 +324,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -344,7 +344,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -364,7 +364,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -384,7 +384,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -405,7 +405,7 @@ public class MdbcStatement implements Statement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/ProxyStatement.java b/mdbc-server/src/main/java/org/onap/music/mdbc/ProxyStatement.java index 059793d..2c3e6b9 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/ProxyStatement.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/ProxyStatement.java @@ -92,7 +92,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return r; @@ -113,7 +113,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -199,7 +199,7 @@ public class ProxyStatement implements CallableStatement { throw e; } } catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -308,7 +308,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; }catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -328,7 +328,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; }catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -348,7 +348,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; }catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return n; } @@ -368,7 +368,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; }catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -388,7 +388,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; }catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } @@ -408,7 +408,7 @@ public class ProxyStatement implements CallableStatement { if (!nm.startsWith(DATASTAX_PREFIX)) throw e; }catch (MDBCServiceException e) { - throw new SQLException(e.getMessage()); + throw new SQLException(e.getMessage(), e); } return b; } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java b/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java index f281548..4a4c89a 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java @@ -131,7 +131,7 @@ public class StateManager { } catch (SQLException e) { logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.CRITICAL, ErrorTypes.GENERALSERVICEERROR); - throw new MDBCServiceException(e.getMessage()); + throw new MDBCServiceException(e.getMessage(), e); } } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/configurations/TablesConfiguration.java b/mdbc-server/src/main/java/org/onap/music/mdbc/configurations/TablesConfiguration.java index 3e3447d..fac47c5 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/configurations/TablesConfiguration.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/configurations/TablesConfiguration.java @@ -119,7 +119,7 @@ public class TablesConfiguration { MusicCore.createTable(internalNamespace,"unsynced_keys", queryObject,"critical"); } catch (MusicServiceException e) { logger.error("Error creating unsynced keys table" ); - throw new MDBCServiceException("Error creating unsynced keys table"); + throw new MDBCServiceException("Error creating unsynced keys table", e); } } diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java index a928526..64fde04 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MusicMixin.java @@ -226,7 +226,7 @@ public class MusicMixin implements MusicInterface { MusicCore.nonKeyRelatedPut(queryObject, "eventual"); } catch (MusicServiceException e) { if (!e.getMessage().equals("Keyspace "+music_ns+" already exists")) { - throw new MDBCServiceException("Error creating namespace: "+music_ns+". Internal error:"+e.getErrorMessage()); + throw new MDBCServiceException("Error creating namespace: "+music_ns+". Internal error:"+e.getErrorMessage(), e); } } } @@ -950,7 +950,7 @@ public class MusicMixin implements MusicInterface { results = MusicCore.get(pQueryObject); } catch (MusicServiceException e) { logger.error("Error executing music get operation for query: ["+cql+"]"); - throw new MDBCServiceException("Error executing get: "+e.getMessage()); + throw new MDBCServiceException("Error executing get: "+e.getMessage(), e); } return results; } @@ -1077,13 +1077,13 @@ public class MusicMixin implements MusicInterface { lockReturn = MusicCore.acquireLock(fullyQualifiedKey,lockId); } catch (MusicLockingException e) { logger.error(EELFLoggerDelegate.errorLogger, "Lock was not acquire correctly for key "+fullyQualifiedKey); - throw new MDBCServiceException("Lock was not acquire correctly for key "+fullyQualifiedKey); + throw new MDBCServiceException("Lock was not acquire correctly for key "+fullyQualifiedKey, e); } catch (MusicServiceException e) { logger.error(EELFLoggerDelegate.errorLogger, "Error in music, when locking key: "+fullyQualifiedKey); - throw new MDBCServiceException("Error in music, when locking: "+fullyQualifiedKey); + throw new MDBCServiceException("Error in music, when locking: "+fullyQualifiedKey, e); } catch (MusicQueryException e) { logger.error(EELFLoggerDelegate.errorLogger, "Error in executing query music, when locking key: "+fullyQualifiedKey); - throw new MDBCServiceException("Error in executing query music, when locking: "+fullyQualifiedKey); + throw new MDBCServiceException("Error in executing query music, when locking: "+fullyQualifiedKey, e); } return lockReturn; } @@ -1106,7 +1106,8 @@ public class MusicMixin implements MusicInterface { } catch (InterruptedException e) { continue; } - if(n++==20){ + n++; + if(n==20){ throw new MDBCServiceException("Lock was impossible to obtain, waited for 20 exponential backoffs!") ; } } @@ -1173,7 +1174,7 @@ public class MusicMixin implements MusicInterface { try { serializedTransactionDigest = MDBCUtils.toString(transactionDigest); } catch (IOException e) { - throw new MDBCServiceException("Failed to serialized transaction digest with error "+e.toString()); + throw new MDBCServiceException("Failed to serialized transaction digest with error "+e.toString(), e); } MusicTxDigestId digestId = new MusicTxDigestId(commitId); addTxDigest(digestId, serializedTransactionDigest); @@ -1283,7 +1284,7 @@ public class MusicMixin implements MusicInterface { newRow = executeMusicUnlockedQuorumGet(pQueryObject); } catch (MDBCServiceException e) { logger.error("Get operationt error: Failure to get row from MRI "+musicRangeInformationTableName); - throw new MDBCServiceException("Initialization error:Failure to add new row to transaction information"); + throw new MDBCServiceException("Initialization error:Failure to add new row to transaction information", e); } return getMRIRowFromCassandraRow(newRow); @@ -1380,7 +1381,7 @@ public class MusicMixin implements MusicInterface { executeMusicLockedPut(this.music_ns,this.musicRangeInformationTableName,id.toString(),query,lockId,null); } catch (MDBCServiceException e) { logger.error("Initialization error: Failure to add new row to transaction information"); - throw new MDBCServiceException("Initialization error:Failure to add new row to transaction information"); + throw new MDBCServiceException("Initialization error:Failure to add new row to transaction information", e); } return id; } @@ -1450,7 +1451,7 @@ public class MusicMixin implements MusicInterface { MusicCore.nonKeyRelatedPut(query,"critical"); } catch (MusicServiceException e) { logger.error(EELFLoggerDelegate.errorLogger, "Transaction Digest serialization was invalid for commit "+newId.txId.toString()+ "with error "+e.getErrorMessage()); - throw new MDBCServiceException("Transaction Digest serialization for commit "+newId.txId.toString()); + throw new MDBCServiceException("Transaction Digest serialization for commit "+newId.txId.toString(), e); } } @@ -1465,7 +1466,7 @@ public class MusicMixin implements MusicInterface { newRow = executeMusicUnlockedQuorumGet(pQueryObject); } catch (MDBCServiceException e) { logger.error("Get operation error: Failure to get row from txdigesttable with id:"+id.txId); - throw new MDBCServiceException("Initialization error:Failure to add new row to transaction information"); + throw new MDBCServiceException("Initialization error:Failure to add new row to transaction information", e); } String digest = newRow.getString("transactiondigest"); HashMap<Range,StagingTable> changes; @@ -1473,10 +1474,10 @@ public class MusicMixin implements MusicInterface { changes = (HashMap<Range, StagingTable>) MDBCUtils.fromString(digest); } catch (IOException e) { logger.error("IOException when deserializing digest failed with an invalid class for id:"+id.txId); - throw new MDBCServiceException("Deserializng digest failed with ioexception"); + throw new MDBCServiceException("Deserializng digest failed with ioexception", e); } catch (ClassNotFoundException e) { logger.error("Deserializng digest failed with an invalid class for id:"+id.txId); - throw new MDBCServiceException("Deserializng digest failed with an invalid class"); + throw new MDBCServiceException("Deserializng digest failed with an invalid class", e); } return changes; } @@ -1632,7 +1633,7 @@ public class MusicMixin implements MusicInterface { try { MusicCore.voluntaryReleaseLock(fullyQualifiedMriKey,ownerId); } catch (MusicLockingException e) { - throw new MDBCServiceException(e.getMessage()); + throw new MDBCServiceException(e.getMessage(), e); } } @@ -1654,14 +1655,14 @@ public class MusicMixin implements MusicInterface { lsHandle = MusicCassaCore.getLockingServiceHandle(); } catch (MusicLockingException e) { logger.error("Error obtaining the locking service handle when checking if relinquish was required"); - throw new MDBCServiceException("Error obtaining locking service"+e.getMessage()); + throw new MDBCServiceException("Error obtaining locking service"+e.getMessage(), e); } long lockQueueSize; try { lockQueueSize = lsHandle.getLockQueueSize(music_ns, this.musicRangeInformationTableName, partition.getMusicRangeInformationIndex().toString()); } catch (MusicServiceException|MusicQueryException e) { logger.error("Error obtaining the lock queue size"); - throw new MDBCServiceException("Error obtaining lock queue size: "+e.getMessage()); + throw new MDBCServiceException("Error obtaining lock queue size: "+e.getMessage(), e); } if(lockQueueSize> 1){ //If there is any other node waiting, we just relinquish ownership @@ -1704,7 +1705,7 @@ public class MusicMixin implements MusicInterface { } catch(MusicServiceException e){ //\TODO: handle better, at least transform into an MDBCServiceException e.printStackTrace(); - throw new MDBCServiceException("Error executing critical get"); + throw new MDBCServiceException("Error executing critical get", e); } if(result.isExhausted()){ throw new MDBCServiceException("There is not a row that matches the id "+primaryKey); @@ -1731,13 +1732,13 @@ public class MusicMixin implements MusicInterface { rt = MusicCore.atomicPut(namespace, tableName, primaryKeyWithoutDomain, queryObject, conditionInfo); } catch (MusicLockingException e) { logger.error("Music locked put failed"); - throw new MDBCServiceException("Music locked put failed"); + throw new MDBCServiceException("Music locked put failed", e); } catch (MusicServiceException e) { logger.error("Music service fail: Music locked put failed"); - throw new MDBCServiceException("Music service fail: Music locked put failed"); + throw new MDBCServiceException("Music service fail: Music locked put failed", e); } catch (MusicQueryException e) { logger.error("Music query fail: locked put failed"); - throw new MDBCServiceException("Music query fail: Music locked put failed"); + throw new MDBCServiceException("Music query fail: Music locked put failed", e); } } else { diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MySQLMixin.java b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MySQLMixin.java index 9a8f543..386865a 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MySQLMixin.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/mixins/MySQLMixin.java @@ -832,7 +832,7 @@ NEW.field refers to the new value logger.error("Unable to replay: " + op.getOperationType() + "->" + op.getNewVal() + "." + "Rolling back the entire digest replay."); jdbcConn.rollback(); - throw new SQLException(e); + throw e; } } } |