Bugfix
com.top_logic.knowledge.indexing.lucene.ContentRetrievalFailedException: Retrieving the description failed! at com.top_logic.knowledge.indexing.lucene.LuceneThread.getDescription(LuceneThread.java:907) at com.top_logic.knowledge.indexing.lucene.LuceneThread.indexContent(LuceneThread.java:899) at com.top_logic.knowledge.indexing.lucene.LuceneThread.indexQueue(LuceneThread.java:831) at com.top_logic.knowledge.indexing.lucene.LuceneThread.workOnQueues(LuceneThread.java:719) at com.top_logic.knowledge.indexing.lucene.LuceneThread$1.run(LuceneThread.java:704) at com.top_logic.knowledge.indexing.lucene.LuceneThread$1.run(LuceneThread.java:699) at com.top_logic.basic.thread.ThreadContextManager.inInteractionInternal(ThreadContextManager.java:810) at com.top_logic.basic.thread.ThreadContextManager.inSystemInteractionInternal(ThreadContextManager.java:832) at com.top_logic.basic.thread.ThreadContextManager.inSystemInteraction(ThreadContextManager.java:294) at com.top_logic.basic.thread.ThreadContext.inSystemContext(ThreadContext.java:156) at com.top_logic.knowledge.indexing.lucene.LuceneThread.workInSystemContext(LuceneThread.java:699) at com.top_logic.knowledge.indexing.lucene.LuceneThread.workHandlingReaderWriter(LuceneThread.java:665) at com.top_logic.knowledge.indexing.lucene.LuceneThread.workSurvivingExceptions(LuceneThread.java:653) at com.top_logic.knowledge.indexing.lucene.LuceneThread.work(LuceneThread.java:615) at com.top_logic.knowledge.indexing.lucene.LuceneThread.run(LuceneThread.java:78) Caused by: java.lang.ClassCastException: class com.top_logic.basic.util.ResKey$LiteralKey cannot be cast to class java.lang.String (com.top_logic.basic.util.ResKey$LiteralKey is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') at com.top_logic.model.TLNamed.getName(TLNamed.java:34) at com.top_logic.knowledge.indexing.DefaultIndexingService$WrapperContentObject.getDescription(DefaultIndexingService.java:836) at com.top_logic.knowledge.indexing.lucene.LuceneThread.getDescription(LuceneThread.java:904) ... 14 more
Analysis
Implementation classes of persistent objects implement tl:com.top_logic.model.TLNamed by default, although the associated model has no or no compatible name attribute. If you declare a name attribute in a class that is not of type String, the String getName() method is still called for the representation of the object, which attempts to cast the value of the name attribute to String. This fails.
Improvement
In tl:com.top_logic.model.TLNamed, convert the value of the name attribute into a string via a suitable tl:LabelProvider if the value is not a string.
Test
- Create type with mandatory "Internationalized string" as name attribute.
- Create an instance of the type in the instance editor.
- com.top_logic.demo/src/test/java/test/com/top_logic/demo/scripted/model/attribute/TestI18NStringAsName.script.xml