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

CIF-2985: prevent NPE when given alternative is null #967

Merged
merged 7 commits into from
Oct 24, 2022
Merged

Conversation

buuhuu
Copy link
Contributor

@buuhuu buuhuu commented Oct 21, 2022

Description

When the list of alternatives passed to the UrlFormatBase#selectUrlPath() contains a null reference a NPE is thrown. While this should not happen, it seems that it could with the BreadcrumbImpl's product query:

Caused by: java.lang.NullPointerException: null
	at com.adobe.cq.commerce.core.components.internal.services.urlformats.UrlFormatBase.selectUrlPath(UrlFormatBase.java:134) [com.adobe.commerce.cif.core-cif-components-core:2.10.0]
	at com.adobe.cq.commerce.core.components.internal.models.v1.breadcrumb.BreadcrumbImpl.fetchProductBreadcrumbs(BreadcrumbImpl.java:302) [com.adobe.commerce.cif.core-cif-components-core:2.10.0]
	at com.adobe.cq.commerce.core.components.internal.models.v1.breadcrumb.BreadcrumbImpl.populateItems(BreadcrumbImpl.java:169) [com.adobe.commerce.cif.core-cif-components-core:2.10.0]
	at com.adobe.cq.commerce.core.components.internal.models.v1.breadcrumb.BreadcrumbImpl.getItems(BreadcrumbImpl.java:119) [com.adobe.commerce.cif.core-cif-components-core:2.10.0]

Related Issue

CIF-2985

Motivation and Context

How Has This Been Tested?

Unit Tests

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@buuhuu buuhuu requested review from herzog31 and LSantha October 21, 2022 13:40
Base automatically changed from issue/CIF-2982 to master October 21, 2022 13:41
@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Merging #967 (3f13f26) into master (cd5b127) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master     #967   +/-   ##
=========================================
  Coverage     89.15%   89.15%           
- Complexity     2211     2212    +1     
=========================================
  Files           354      354           
  Lines          9985     9987    +2     
  Branches       1437     1438    +1     
=========================================
+ Hits           8902     8904    +2     
  Misses          787      787           
  Partials        296      296           
Flag Coverage Δ
integration 51.78% <0.00%> (-0.02%) ⬇️
jest 86.68% <ø> (ø)
karma 95.53% <ø> (ø)
unittests 87.43% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ts/internal/services/urlformats/UrlFormatBase.java 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@buuhuu buuhuu merged commit d7a4f25 into master Oct 24, 2022
@buuhuu buuhuu deleted the issue/CIF-2985 branch October 24, 2022 11:22
@buuhuu buuhuu added the bug Something isn't working label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants