Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-29287-Fixed null handling for boolean #87

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}