In case an asset is referenced in an image component whose name does not contain a dot, this leads to an NPE
...
Caused by: org.apache.sling.models.factory.PostConstructException: Post-construct method has thrown an exception for model class com.adobe.cq.wcm.core.components.models.impl.v1.ImageImpl
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:609)
at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory.java:335)
at org.apache.sling.models.impl.ModelAdapterFactory.createModel(ModelAdapterFactory.java:223)
at org.apache.sling.scripting.sightly.models.impl.SlingModelsUseProvider.provide(SlingModelsUseProvider.java:126)
at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:72)
... 115 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.adobe.cq.wcm.core.components.models.impl.v1.ImageImpl.initModel(ImageImpl.java:148)
at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.sling.models.impl.ModelAdapterFactory.invokePostConstruct(ModelAdapterFactory.java:792)
at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:607)
... 119 common frames omitted
In case an asset is referenced in an image component whose name does not contain a dot, this leads to an NPE
The reason is the extension always being extracted from the asset's node name (https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/models/impl/v1/ImageImpl.java#L128). See also the related ticket #38. The recommended fix here is similar: Always derive the extension from the mime type!