[Geoserver-devel] [JIRA] (GEOS-10332) GrowableInternationalStringConverter can cause random XStream conversion failures

Andrea Aime created an issue

GeoServer / ImprovementGEOS-10332

GrowableInternationalStringConverter can cause random XStream conversion failures

Issue Type:

ImprovementImprovement

Assignee:

Unassigned

Created:

10/Dec/21 11:51 AM

Priority:

MediumMedium

Reporter:

Andrea Aime

Trying to run importer-jdbc tests I’ve found the GrowableInternationaString coverter being used to convert an exception (ImportTask has a field that’s an exception):

java.lang.ClassCastException: java.lang.Exception cannot be cast to org.geotools.util.GrowableInternationalString

at org.geoserver.config.util.XStreamPersister$GrowableInternationalStringConverter.doMarshal(XStreamPersister.java:2624)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
at com.thoughtworks.xstream.converters.extended.ThrowableConverter.marshal(ThrowableConverter.java:62)
at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:270)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:174)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
at org.geoserver.config.util.XStreamPersister$ProxyCollectionConverter.writeCompleteItem(XStreamPersister.java:1376)
at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)

This happens because the converter has the class check in canConvert backwards, checks if the target class is a superclass of GrowableInternationalString, and the ThrowableConverter, for some reason, may search for a “converter of Object.class”.

Does not always happen, seems to be related to a classpath lookup chance.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100183-sha1:f6eba4b)

Atlassian logo