Detail
Detail
Bugfix
DerivedTLTypePart.isDerived() throws a NullPointerException in some cases, for example with tl.legacy.tabletypes:hasRoleTable#source.
Stacktrace:
java.lang.NullPointerException at com.top_logic.element.meta.kbbased.ConfiguredAttributeImpl.createStorageImplementation(ConfiguredAttributeImpl.java:40) at com.top_logic.element.meta.kbbased.ConfiguredAttributeImpl.getStorageImplementation(ConfiguredAttributeImpl.java:33) at com.top_logic.element.meta.kbbased.ConfiguredAttributeImpl.getStorageImplementation(ConfiguredAttributeImpl.java:16) at com.top_logic.element.meta.AttributeOperations.isReadOnly(AttributeOperations.java:970) at com.top_logic.element.meta.kbbased.ConfiguredAttributeImpl.isDerived(ConfiguredAttributeImpl.java:46)
Analysis
The reason is that StorageImplementationFactory.createStorageImplementation(...) returns zero:
at com.top_logic.element.meta.kbbased.StorageImplementationFactory$1.visitAssociationEnd(StorageImplementationFactory.java:86) at com.top_logic.element.meta.kbbased.StorageImplementationFactory$1.visitAssociationEnd(StorageImplementationFactory.java:47) at com.top_logic.element.meta.kbbased.PersistentEnd.visitTypePart(PersistentEnd.java:163) at com.top_logic.element.meta.kbbased.StorageImplementationFactory.createDefaultStorageImplementation(StorageImplementationFactory.java:153) at com.top_logic.element.meta.kbbased.StorageImplementationFactory.createStorageImplementation(StorageImplementationFactory.java:127) at com.top_logic.element.meta.kbbased.ConfiguredAttributeImpl.createStorageImplementation(ConfiguredAttributeImpl.java:39)
This in turn is due to the fact that StorageImplementationFactory.DEFAULT_STORAGE_IMPLEMENTATION.new TLTypePartVisitor() {...}.visitAssociationEnd(...) is implemented with return null; instead of returning com.top_logic.element.meta.kbbased.NoStorage.INSTANCE.
Test
TestTLStructuredTypePart.testNoException()