[Geoserver-devel] [JIRA] (GEOS-10640) OGC API - Features - Output to JSON fails with class cast exception

Sebastian Frey created an issue

GeoServer / BugGEOS-10640

OGC API - Features - Output to JSON fails with class cast exception

Issue Type:

BugBug

Assignee:

Unassigned

Components:

Community modules

Created:

31/Aug/22 10:10 AM

Environment:

When requesting features as JSON java.lang.ClassCastException is thrown:

java.lang.ClassCastException: class [Ljava.lang.String; cannot be cast to class java.lang.String ([Ljava.lang.String; and java.lang.String are in module java.base of loader 'bootstrap')
  at org.geoserver.wfs.GetFeature.lambda$mapValuesToStrings$3(GetFeature.java:1067)
  at java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1666)
  at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
  at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1764)
  at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
  at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
  at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
  at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
  at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
  at org.geoserver.wfs.GetFeature.mapValuesToStrings(GetFeature.java:1064)
  at org.geoserver.wfs.GetFeature.buildResults(GetFeature.java:1051)
  at org.geoserver.wfs.GetFeature.run(GetFeature.java:649)
  at org.geoserver.ogcapi.features.FeatureService.items(FeatureService.java:367)
...

In org.geoserver.wfs.GetFeature:1067 values are casted to String:

(String) e.getValue()

I will provide a PR, which changes this to:

String.valueOf(e.getValue())

Priority:

MediumMedium

Reporter:

Sebastian Frey

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#100206-sha1:e4fd81d)

Atlassian logo