-
Notifications
You must be signed in to change notification settings - Fork 79
CIF-2215 - Breadcrumb error when no dynamic category page is present #697
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
Conversation
* fixed NPEs when dynamic categoryPage or productPage is null
Codecov Report
@@ Coverage Diff @@
## master #697 +/- ##
============================================
- Coverage 88.58% 88.57% -0.01%
- Complexity 1600 1604 +4
============================================
Files 282 282
Lines 7131 7135 +4
Branches 1048 1051 +3
============================================
+ Hits 6317 6320 +3
Misses 618 618
- Partials 196 197 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* added unit test
|
|
||
| String path = page.getPath(); | ||
| return (path.contains(productPagePath + "/") || path.contains(categoryPagePath + "/")); | ||
| return (productPagePath != null && path.contains(productPagePath + "/") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: while we are on it this check should probably be done using Text.isDescendant https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/text/Text.html#isDescendantOrEqual-java.lang.String-java.lang.String-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#contains-java.lang.CharSequence-java.lang.CharSequence (which is already used in this class) can be used that includes the null check.
|
|
||
| String path = page.getPath(); | ||
| return (path.contains(productPagePath + "/") || path.contains(categoryPagePath + "/")); | ||
| return (productPagePath != null && path.contains(productPagePath + "/") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#contains-java.lang.CharSequence-java.lang.CharSequence (which is already used in this class) can be used that includes the null check.
Fixed NPEs when dynamic categoryPage or productPage is null.
Related Issue
CIF-2215
How Has This Been Tested?
Manually, unit tests.
Types of changes
Checklist: