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

CustomBigDecimalComparator NullPointerException #769

Closed
buderjoh opened this issue Jan 14, 2019 · 4 comments
Closed

CustomBigDecimalComparator NullPointerException #769

buderjoh opened this issue Jan 14, 2019 · 4 comments

Comments

@buderjoh
Copy link

@buderjoh buderjoh commented Jan 14, 2019

If you use org.javers.core.diff.custom.CustomBigDecimalComparator with a null value you get an NPE

image

There should be a null check for setScale and possibly for aRounded.equals(bRounded); aswell.

Also minor issue

The comment in line 21 is missing the .class -> BigDecimal.class

JaversBuilder.javers().registerCustomComparator(new CustomBigDecimalComparator(2), BigDecimal).build();

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jan 15, 2019

You are right. CustomBigDecimalComparator is here just to serve as the example of CustomComparator, so it's not critical. Contribute a PR with the fix if you like.

Loading

@buderjoh
Copy link
Author

@buderjoh buderjoh commented Jan 16, 2019

Yeah it is not critical :)
i have written my own Comparator

PR -> 771

Loading

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jan 18, 2019

merged, it will be released in the next release

Loading

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Feb 16, 2019

fix released in 5.2.0

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants