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

Add null check for actual date/time truncation #2467

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

papiomytoglou
Copy link
Contributor

A missing null check in DateTimeTruncation#truncate results in null pointer exceptions whenever the user uses a matcher which includes truncateActual. This largely makes truncateActual unusable since it breaks functionality, especially when the mapping including truncateActual is added last.

References

Fixes #2466

Submitter checklist

  • Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • Recommended: If you participate in Hacktoberfest 2023, make sure you're signed up there and in the WireMock form
  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

@papiomytoglou papiomytoglou requested a review from a team as a code owner October 28, 2023 19:03
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Thanks! There is still an open issue with documentation/annotations and downstream use, but it definitely prevents NPE in this method. So it is net positive and should be merged IMO

@papiomytoglou
Copy link
Contributor Author

Thank you for your response @oleg-nenashev. I'd gladly add any required documentation, it's just not clear to me what it should be since neither the signature nor the return value of the method were affected. If you could point me to any relevant guidelines I will amend the PR.

@oleg-nenashev
Copy link
Member

@papiomytoglou Yes, this is actually the main problem. At the moment we do not have an agreed standard and guidelines on annotations, so it is not something one could address at the moment. Let's get it merged

@oleg-nenashev oleg-nenashev merged commit 3df1a7a into wiremock:master Oct 30, 2023
6 of 7 checks passed
@papiomytoglou papiomytoglou changed the title Add null check for actual date/time truncation (#2466) Add null check for actual date/time truncation Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"truncateActual" results in null pointer exceptions
2 participants