dxa-web-application-java icon indicating copy to clipboard operation
dxa-web-application-java copied to clipboard

Enhance treatment of null when the semanticSchema is not registered

Open tfinez opened this issue 9 years ago • 2 comments

Class: EntityBuilderImpl Function: createEntity Description: When the getMappedModelTypes is null, there's no control over the result and following functions are executed, of course that finally there's a NullPointer exception but the result must be controlled before.
Branch: master

final Class<? extends AbstractEntityModel> entityClass = (Class<? extends AbstractEntityModel>) viewModelRegistry.getMappedModelTypes(semanticSchema.getFullyQualifiedNames());

    return createEntity(component, localization, entityClass, semanticSchema);

tfinez avatar Sep 02 '16 11:09 tfinez

Although this means that your model is nor properly registered, this should be different exception than NPE. So basically we should add here some explicit error handling when entity class is not found instead of failing on NPE later. Good point.

azarakovskiy avatar Sep 06 '16 08:09 azarakovskiy

TSI-1938 (internal issue ID for tracking purposes)

rpannekoek avatar Sep 12 '16 14:09 rpannekoek