Skip to content

Commit

Permalink
Update logging - minor fix for classcastexception in decrypt ssn
Browse files Browse the repository at this point in the history
  • Loading branch information
sree-cfa committed Jan 16, 2024
1 parent 6e4f6a1 commit 1c54008
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
13 changes: 9 additions & 4 deletions src/main/java/org/ladocuploader/app/cli/FtpsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,16 @@ public void uploadFile(String zipFilename, byte[] data) throws IOException {
ftp.enterLocalPassiveMode();
ftp.pasv();
InputStream local = new ByteArrayInputStream(data);
ftp.storeFile(zipFilename, local);
boolean isComplete = ftp.storeFile(zipFilename, local);
local.close();
ftp.completePendingCommand();

ftp.logout();
ftp.disconnect();
try {
if (isComplete || ftp.completePendingCommand()) {
ftp.logout();
ftp.disconnect();
}
} catch (IOException e) {
log.error("Failed to finalize transfer", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private void transferSubmissionBatch(List<Submission> submissionsBatch) {

// Wait until these have successfully transmitted before marking as complete
for (var transmission : successfulTransmissions) {
log.info("Updating transmission statuses to Complete");
transmission.setStatus(TransmissionStatus.Complete);
updateTransmission(uuid, transmission);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import org.ladocuploader.app.submission.StringEncryptor;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static java.util.Collections.emptyList;
import static org.ladocuploader.app.utils.SubmissionUtilities.ENCRYPTED_SSNS_INPUT_NAME;
Expand Down Expand Up @@ -37,8 +36,8 @@ public void run(Submission submission) {
submission.getInputData().put("ssn", decryptedSSN);
}

List<LinkedHashMap> householdMembers = (ArrayList) submission.getInputData().getOrDefault("household", emptyList());
for (LinkedHashMap hhmember : householdMembers) {
List<Map<String, Object>> householdMembers = (List) submission.getInputData().getOrDefault("household", emptyList());
for (var hhmember : householdMembers) {
String ssnKey = getDecryptedSSNKeyName((String) hhmember.get("uuid"));
encryptedSSN = (String) hhmember.remove(ENCRYPTED_SSNS_INPUT_NAME);
String decryptedSSN = getEncryptor().decrypt(encryptedSSN);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ spring:
session:
timeout: 2h
logging:
pattern:
console:
level:
root: INFO
org:
springframework:
boot:
Expand Down

0 comments on commit 1c54008

Please sign in to comment.