diff --git a/optout/src/main/java/gov/cms/ab2d/optout/OptOutHandler.java b/optout/src/main/java/gov/cms/ab2d/optout/OptOutHandler.java index a68bd56..d971455 100644 --- a/optout/src/main/java/gov/cms/ab2d/optout/OptOutHandler.java +++ b/optout/src/main/java/gov/cms/ab2d/optout/OptOutHandler.java @@ -32,10 +32,10 @@ public void processSQSMessage(SQSEvent.SQSMessage msg, Context context) { var optOutProcessing = processorInit(logger); var countRes = optOutProcessing.process(getFileName(notification), getBucketName(notification), ENDPOINT); - - logger.log("OptOut Lambda completed. Total=" + countRes.getTotalFromDB() - + " In=" + countRes.getOptInToday() - + " Out=" + countRes.getOptOutToday()); + if (countRes != null) + logger.log("OptOut Lambda completed. Total=" + countRes.getTotalFromDB() + + " In=" + countRes.getOptInToday() + + " Out=" + countRes.getOptOutToday()); } catch (Exception ex) { diff --git a/optout/src/main/java/gov/cms/ab2d/optout/OptOutProcessor.java b/optout/src/main/java/gov/cms/ab2d/optout/OptOutProcessor.java index 1c09603..c5db381 100644 --- a/optout/src/main/java/gov/cms/ab2d/optout/OptOutProcessor.java +++ b/optout/src/main/java/gov/cms/ab2d/optout/OptOutProcessor.java @@ -140,11 +140,7 @@ public CountResults getCountsOptOut() { var statement = dbConnection.createStatement(); ResultSet rs = statement.executeQuery(COUNT_STATEMENT) ) { - logger.log("statement " + statement); - logger.log("RS " + rs); while (rs.next()) { - logger.log("Inside RS"); - logger.log("rs.getInt(0) " + rs.getInt("total")); totalFromDb = rs.getInt("total"); } //rename: @@ -159,11 +155,9 @@ public CountResults getCountsOptOut() { } } //delete - logger.log("Total = " + totalFromDb); - logger.log("numberOfYOptOuts = " + numberOfYOptOuts); return new CountResults(totalFromDb, numberOfYOptOuts, numberOfNOptOuts); - } catch (SQLException e) { - logger.log("---------!" + e.getMessage()); + } catch (SQLException ex) { + logger.log("There is an error " + ex.getMessage()); } return null; }