updating the attributes using modifyfeatures(Name[],Object[],Filter) is throwing an exception java.lang.ClassCastException: java.lang.String cannot be cast to org.opengis.feature.type.AttributeDescriptor

Description

My code is as follows:
for (int i = 0, count = feature.getType().getAttributeCount(); i < count; i++) {
String attrName = feature.getType().getDescriptor.getLocalName();
if (!"geometry".equals(attrName)) {
Object value = feature.getAttribute(attrName);
names.add(featureSource.getSchema().getDescriptor(attrName).getName());
values.add(value);
}
}
featureSource.modifyFeatures(nameArray, values.toArray(), filter);
Object value = feature.getAttribute("geometry");
featureSource.modifyFeatures("geometry", value, filter);

When I am trying to update the feature attributes getting the below exception
ERROR [geoserver.rest] - java.lang.String cannot be cast to org.opengis.feature.type.AttributeDescriptor
java.lang.ClassCastException: java.lang.String cannot be cast to org.opengis.feature.type.AttributeDescriptor
at org.geotools.data.jdbc.FilterToSQL.visitBinaryComparisonOperator(FilterToSQL.java:792)
at org.geotools.data.jdbc.FilterToSQL.visit(FilterToSQL.java:689)
at org.geotools.filter.IsEqualsToImpl.accept(IsEqualsToImpl.java:157)
at org.geotools.data.jdbc.FilterToSQL.visit(FilterToSQL.java:664)
at org.geotools.data.jdbc.FilterToSQL.visit(FilterToSQL.java:606)
at org.geotools.filter.AndImpl.accept(AndImpl.java:52)
at org.geotools.data.jdbc.FilterToSQL.encode(FilterToSQL.java:301)
at org.geotools.data.jdbc.FilterToSQL.encodeToString(FilterToSQL.java:330)
at org.geotools.jdbc.JDBCDataStore.updateSQL(JDBCDataStore.java:4363)
at org.geotools.jdbc.JDBCDataStore.update(JDBCDataStore.java:2017)
at org.geotools.jdbc.JDBCFeatureStore.modifyFeatures(JDBCFeatureStore.java:377)

Environment

None

Assignee

Unassigned

Reporter

Shashidhar S

Triage

Components

Priority

Medium
Configure