Skip to content

Commit

Permalink
Merge pull request #87 from LoganathanSekar7627/MOSIP-29287-correctio…
Browse files Browse the repository at this point in the history
…n-to-logging-the-response

MOSIP-29287-Fixed null handling for boolean
  • Loading branch information
vishwa-vyom authored Oct 17, 2023
2 parents 09ef127 + 974f156 commit d6438c5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public String toString(BDBInfo bdbInfo) {
stringBuilder.append(", \"format\": ");
stringBuilder.append(stringOf(bdbInfo.getFormat()));
stringBuilder.append(", \"encryption\":");
stringBuilder.append(Boolean.toString(bdbInfo.getEncryption()));
stringBuilder.append(booleanAsString(bdbInfo.getEncryption()));
stringBuilder.append(", \"creationDate\": ");
stringBuilder.append(surroundWithQuote(DateUtils.formatToISOString(bdbInfo.getCreationDate())));
stringBuilder.append(", \"notValidBefore\": ");
Expand Down Expand Up @@ -296,7 +296,7 @@ public String toString(BIRInfo birInfo) {
stringBuilder.append(", \"payloadHash\":");
stringBuilder.append(getHashOfBytes(birInfo.getPayload()));
stringBuilder.append(", \"integrity\":");
stringBuilder.append(Boolean.toString(birInfo.getIntegrity()));
stringBuilder.append(booleanAsString(birInfo.getIntegrity()));
stringBuilder.append(", \"creationDate\": ");
stringBuilder.append(surroundWithQuote(DateUtils.formatToISOString(birInfo.getCreationDate())));
stringBuilder.append(", \"notValidBefore\": ");
Expand All @@ -306,4 +306,8 @@ public String toString(BIRInfo birInfo) {
stringBuilder.append(" }");
return stringBuilder.toString();
}

private static String booleanAsString(Boolean bool) {
return bool == null ? "null" : Boolean.toString(bool);
}
}

0 comments on commit d6438c5

Please sign in to comment.