chibenwa commented on code in PR #3194:
URL: https://github.com/apache/james-project/pull/3194#discussion_r4126535683
##########
server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSCacheableMailQueue.java:
##########
@@ -485,8 +540,22 @@ protected MailImpl.Builder populateMail(Message message)
throws JMSException {
private Stream<Attribute> mailAttribute(Message message, String name) {
// Now cast the property back to Serializable and set it as attribute.
- // See JAMES-1241
- Object attrValue =
Throwing.function(message::getObjectProperty).apply(name);
+ // See JAMES-1241. Property name is encoded to ensure it is a valid
JMS identifier.
+ Object attrValue = Throwing.function((String prop) -> {
+ try {
+ Object val = message.getObjectProperty(prop);
+ if (val != null) {
+ return val;
+ }
+ } catch (Exception e) {
+ // Fall back to raw name if property name check failed
+ }
+ try {
+ return message.getObjectProperty(name);
+ } catch (Exception e) {
+ return null;
Review Comment:
This is poor error management. We need to improve this.
Logging and skipping the failed attribute seems like a better strategy.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]