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

fix: persisting null value for a non-nullable field in affected party #158

Merged
merged 4 commits into from
Dec 21, 2022

Conversation

prit-cgi
Copy link
Contributor

No description provided.

@@ -46,6 +46,9 @@ protected Transaction transactionStart(HttpServletRequest request, TransactionTy
* @param identifier The value of the identifier
*/
protected void addAffectedParty(Transaction transaction, IdentifierType type, String identifier, AffectedPartyDirection direction) {
if (identifier == null || identifier.isBlank() || type == null || direction == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use StringUtils.isEmpty() in place of the first two checks.

The type and direction checks are probably not required as the only reason this would happen is through bad coding. If you want to validate a method against bad usage you would typically throw an IllegalArgumentException though I don't think it's necessary in this case as we aren't using them consistently in the code base. Which isn't a horrible thing as this isn't library/api code.

If the identifier is null it also might be useful to add a logger.info message. That way there's a record of the fact that the auditing couldn't be done.

@prit-cgi prit-cgi merged commit 4fe020f into main Dec 21, 2022
@prit-cgi prit-cgi deleted the 8460-transaction-null-identity branch December 21, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants