MockAsset.removeRendition can throw NPE

Description

In MockAsset.removeRendition a NPE can occur if a non-existing rendition is removed, see (1). In that case rendition is null and thus a NPE is thrown at line 226.

(1) https://github.com/wcm-io/wcm-io-testing/blob/319bea35d3a7bcb253012b23044f987053f79ec3/aem-mock/core/src/main/java/io/wcm/testing/mock/aem/dam/MockAsset.java#L211

Activity

Show:
Stefan Seifert
December 9, 2019, 10:02 AM

should be - when rendition is null the method is exited with exceptions a few lines above (same behavior as the original AEM implementation)

Jörg Hoh
December 12, 2019, 11:10 AM
Stefan Seifert
December 12, 2019, 9:32 PM

ah, i see there is a difference between the Granite Asset impl and the CQ Asset impl - although the latter wraps only the former in case of removeRendition, it swallows (and logs) the exception of the former in case no rendition exists. so you're right, the method should not complain in this case.
https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/adobe/granite/asset/api/Asset.html#removeRendition(java.lang.String)

fixed in https://github.com/wcm-io/wcm-io-testing/commit/c2ff7988789c415375e70b3ee789b0c8dfbd1708

Jörg Hoh
December 13, 2019, 7:36 AM

Thanks Stefan!

When is the next version of AEM Mocks going to be released? I see the fixedVersion is set to 2.7.2 which is already released

Stefan Seifert
December 13, 2019, 7:45 AM

last release was 2.7.0 - i plan to release 2.7.2 early next week

Fixed

Assignee

Stefan Seifert

Reporter

Jörg Hoh

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure