MockAsset.removeRendition can throw NPE
Description
Activity
Stefan Seifert December 13, 2019 at 7:45 AM
last release was 2.7.0 - i plan to release 2.7.2 early next week
Jörg Hoh December 13, 2019 at 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 12, 2019 at 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 12, 2019 at 11:10 AM
Not really, removeRenditions does not throw an AssetException. Not according to the API documentation.
Stefan Seifert December 9, 2019 at 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)
In MockAsset.removeRendition a NPE can occur if a non-existing rendition is removed, see (1). In that case
rendition
isnull
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