davsclaus opened a new pull request, #29143:
URL: https://github.com/apache/camel/pull/29143

   https://issues.apache.org/jira/browse/CAMEL-26567
   
   camel-jms and camel-sjms chose the JMS message type with `body instanceof 
String`. Other text, such as a `StringBuilder` or a Groovy GString, is 
`Serializable` and was sent as an ObjectMessage. ObjectMessage is off by 
default since 4.14, so the exchange failed, and the error only said to set 
`objectMessageEnabled=true`. With that set, a consumer then blocks a class it 
does not allow ("deserialization blocked for class: 
org.codehaus.groovy.runtime.GStringImpl").
   
   Found by the local-model benchmark (example 
connect-service-jms-request-reply, step 3): two runs set 
`objectMessageEnabled=true` and then failed on the deserialization filter.
   
   **Change**
   - `JmsBinding` in camel-jms and camel-sjms sends any `CharSequence` as a 
TextMessage, and the consumer gets a String. `jmsMessageType=Object` (and the 
`CamelJmsMessageType` header in camel-jms) still forces an ObjectMessage.
   - When a body would be sent as an ObjectMessage and `objectMessageEnabled` 
is false, the error names the class of the body. It says to convert the body to 
a String (`convertBodyTo` with type String) or to marshal it, and still names 
`objectMessageEnabled=true` for a body that should be a serialized Java object.
   - camel-amqp, camel-activemq, camel-activemq6 and camel-sjms2 inherit the 
change.
   - The message mapping tables of the jms, sjms and sjms2 docs list 
`CharSequence` as text, and the 4.24 upgrade guide has an entry.
   - This is still needed with CAMEL-26566: a GString that a Groovy bean method 
returns, or that a script sets as the body itself, stays a GString.
   
   **Tests**
   - camel-jms: new `JmsCharSequenceBodyTest` (3 tests on the embedded Artemis 
broker, one of them a request-reply), and a test each in `JmsBindingTest` and 
`JmsObjectMessageEnabledTest`. camel-sjms: new `CharSequenceBodyTest` (3 tests) 
and a test in `SjmsObjectMessageEnabledTest`. They fail without the change.
   - camel-jms: 486 unit tests pass (11 skipped, as before; the integration 
tests were not run). camel-sjms: 196 (5 skipped, as before). camel-sjms2: 28.
   
   Related: CAMEL-26566 (camel-groovy gives a String for a GString). Both PRs 
add an entry at the same place in the upgrade guide, so the second one to merge 
needs a rebase.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to