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

LineItem.java #684 hasDiscounts() Returns Null #80

Open
bryannevega opened this issue Apr 19, 2020 · 2 comments
Open

LineItem.java #684 hasDiscounts() Returns Null #80

bryannevega opened this issue Apr 19, 2020 · 2 comments

Comments

@bryannevega
Copy link

If the object doesn't have any discounts the line item object doesn't have a "hasDiscounts" boolean field nor the method returns false.

In order to avoid the issue, I use
lineItem.getDiscounts != null
where it could be :

if(lineItem.hasDiscounts){
//Logic
}

Is this the intended behavior or can this be considered into implementation?

@AchinthaShiran
Copy link

To use in the if condition, it should return a Boolean value, in your case it does not.

@bryannevega
Copy link
Author

bryannevega commented Apr 19, 2020

To use in the if condition, it should return a Boolean value, in your case it does not.

Exactly, it always returns a NPE because the object itself doesn't have a field "hasDiscounts".

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

No branches or pull requests

2 participants