major
minor
major
minor
minor
#27204
PersistentEnumeration.tValue(...) leads to ClassCastException
The following call causes an error in the demo: {{{#!java TLModelUtil.resolveQualifiedName("tl5.enum:tl.beacon.three")
.tValueByName("annotations")
}}}
The cause is likely PersistentEnumeration.tValue(TLStructuredTypePart). There, PersistentObjectImpl.getValue(this, part) is called. This ultimately leads to `PrimitiveStorage.getAttributeValue(TLObject, TLStructuredTypePart)`. There, if `attribute.isMultiple() ` is true, the `storageValue ` is cast to a `String` without verification, even though it is a `Config` interface (`PersistentModelPart$AnnotationConfigs`).
This issue may also affect other classes and methods of the persistent model.
Noticed in the inspector: Inspect the TLEnumerations table in the administration console. Expand tableData -> tableModel -> inner -> rows. Expanding rows fails, and this error message appears in the log.
Stack trace
java.lang.ClassCastException: class com.sun.proxy.$Proxy1285 cannot be cast to class java.lang.String (com.sun.proxy.$Proxy1285 is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @39c11e6c; java.lang.String is in module java.base of loader 'bootstrap')
at com.top_logic.element.meta.kbbased.storage.PrimitiveStorage.getAttributeValue(PrimitiveStorage.java:132)
at com.top_logic.element.meta.AttributeOperations.getAttributeValue(AttributeOperations.java:223)
at com.top_logic.element.meta.kbbased.PersistentObjectImpl.getValue(PersistentObjectImpl.java:152)
at com.top_logic.element.meta.kbbased.PersistentEnumeration.tValue(PersistentEnumeration.java:57)
at com.top_logic.element.meta.kbbased.storage.PrimitiveStorage.getAttributeValue(PrimitiveStorage.java:132)
at com.top_logic.element.meta.AttributeOperations.getAttributeValue(AttributeOperations.java:223)
at com.top_logic.element.meta.kbbased.PersistentObjectImpl.getValue(PersistentObjectImpl.java:152)
at com.top_logic.element.meta.kbbased.PersistentEnumeration.tValue(PersistentEnumeration.java:57)
at com.top_logic.layout.inspector.model.nodes.InspectorTLObjectNode.makeChildren(InspectorTLObjectNode.java:57)
at com.top_logic.layout.inspector.model.InspectorTreeBuilder.createChildList(InspectorTreeBuilder.java:46)
[...]
Data Migration
Automatic Data Migration: Ticket_27204_Update_annotations_storage.migration.xml
Test
test.com.top_logic.element.meta.TestTLMetaModel