Claus Ibsen created CAMEL-26300:
-----------------------------------
Summary: Data type transformers: bugs found by the runtime tests
of their body types
Key: CAMEL-26300
URL: https://issues.apache.org/jira/browse/CAMEL-26300
Project: Camel
Issue Type: Bug
Components: camel-pinecone, camel-aws2, camel-ai, camel-jackson,
camel-google
Reporter: Claus Ibsen
Fix For: 4.24.0
Runtime tests of the data type transformers (CAMEL-25928, the body types of the
transformers, PR https://github.com/apache/camel/pull/28449) found these bugs.
Each was shown by running the transformer in a unit test; the code is not
changed by that PR, whose body types describe what the transformers do today.
h3. camel-ai: pinecone
* *pinecone:rag returns an empty List for a Pinecone query result*
({{PineconeReverseEmbeddingsDataTypeTransformer}}). A QUERY leaves a
{{QueryResponseWithUnsignedIndices}}, but the transformer calls
{{getBody(List.class)}}, which gives null for that object, so the result is
silently an empty List. It only works when given {{response.getMatchesList()}}.
* *pinecone:embeddings stores no text*
({{PineconeEmbeddingsDataTypeTransformer}}): the body is not read and no
{{text_segment}} metadata is written, but pinecone:rag reads exactly that
metadata, so an embeddings-then-rag round trip gives "" for every match.
h3. camel-jackson
* *application-json rejects a Map, a List, plain text, bytes or a stream*
without a content class ({{JsonDataTypeTransformer}}): it writes with root type
{{JsonNode}}, and Jackson refuses those types ("Incompatible types: declared
root type JsonNode"). Only JSON text or a POJO works, while a Map is the
obvious body to expect to work. Same in camel-jackson3.
* *application-x-java-object, avro-x-java-object and protobuf-x-java-object
throw a NullPointerException on a null body* when {{X-Content-Class}} is set:
{{message.getBody().getClass()}} in {{JsonPojoDataTypeTransformer}}.
* *jackson 2 avro-x-java-object and protobuf-x-java-object fail on a JsonNode
body* with an unwrapped {{UnsupportedOperationException}}
("TreeTraversingParser does not support schema of type 'avro'/'protobuf'");
camel-jackson3 handles it.
* *camel-jackson3-avro and camel-jackson3-protobuf let JacksonException through
unwrapped* (it is a RuntimeException, so their catch blocks miss it), where the
jackson 2 transformers wrap errors in {{CamelExecutionException}}.
* *avro-x-struct does not take JSON text, but protobuf-x-struct does*: Avro
reads the text as Avro binary and fails.
h3. camel-aws2
* *aws2-sqs:application-cloudevents builds the CloudEvent source from the
receipt handle* ({{aws.sqs.queue.<receiptHandle>}}), not the queue name
({{AWS2SQSCloudEventDataTypeTransformer}}).
* *aws2-ddb:application-x-struct* says "Transforms DynamoDB record into a Json
node" but leaves a JSON String, and fails with Gson's {{JsonIOException}} on a
stream or a file body (Gson cannot reflect into java.io classes on Java 21)
({{Ddb2JsonStructDataTypeTransformer}}).
h3. camel-google
* *google-calendar-stream:application-cloudevents throws a NullPointerException
on any body that is not a calendar Event*
({{GoogleCalendarStreamCloudEventDataTypeTransformer}} calls
{{message.getBody(Event.class).getEventType()}}), where a clear error would be
expected. The consumer always gives an Event, so this only shows when the
transformer is used elsewhere.
h3. camel-ai: milvus, neo4j, qdrant, pinecone, weaviate
* *A bare NullPointerException when the embedding header
(CamelLangChain4jEmbeddingsVector) is missing* in the embeddings transformers;
pgvector gives a clear message. neo4j:rag also casts the "text" value to
String, so a non-String value throws ClassCastException.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)