Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I use code below to generate a CsdlLogicalOrComparisonExpression.
CsdlLogicalOrComparisonExpression conditionExp = new CsdlLogicalOrComparisonExpression(CsdlLogicalOrComparisonExpression.LogicalOrComparisonExpressionType.Eq); conditionExp.setLeft(new CsdlPath().setValue("age")); conditionExp.setRight(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Int, "30"));
If serialize with ODataXmlSerializer, it works fine, result is as below.
<Eq><Path>age</Path> <Int>30</Int> </Eq>
But when I use ODataJsonSerializer, an error occurs.
Caused by: com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a valueCaused by: com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:2080) at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeFieldName(UTF8JsonGenerator.java:220) at com.fasterxml.jackson.core.JsonGenerator.writeObjectFieldStart(JsonGenerator.java:1754) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendConstantExpression(MetadataDocumentJsonSerializer.java:1086) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendExpression(MetadataDocumentJsonSerializer.java:844) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendLogicalOrComparisonExpression(MetadataDocumentJsonSerializer.java:1051) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendDynamicExpression(MetadataDocumentJsonSerializer.java:870) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendExpression(MetadataDocumentJsonSerializer.java:846) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendDynamicExpression(MetadataDocumentJsonSerializer.java:1020) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendExpression(MetadataDocumentJsonSerializer.java:846) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendAnnotations(MetadataDocumentJsonSerializer.java:831) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendEntityTypes(MetadataDocumentJsonSerializer.java:624) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendSchema(MetadataDocumentJsonSerializer.java:176) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.appendDataServices(MetadataDocumentJsonSerializer.java:157) at org.apache.olingo.server.core.serializer.json.MetadataDocumentJsonSerializer.writeMetadataDocument(MetadataDocumentJsonSerializer.java:151) at org.apache.olingo.server.core.serializer.json.ODataJsonSerializer.metadataDocument(ODataJsonSerializer.java:167)