This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 439eb059a21dcd16a1834d3f5591a8a511b02cf9 Author: opencode <[email protected]> AuthorDate: Thu Oct 8 17:37:55 2026 +0200 Match Jakarta namespace JMS types when classifying @Resource annotations. The type-string dispatch in WebAnnotationSet.addResource() still compared the pre-Jakarta javax.jms and javax.resource literals. Since the codebase uses the jakarta.* namespace and neither the javax nor the jakarta JMS API is bundled with Tomcat, the javax.jms.Queue and javax.jms.Topic comparisons could never match, so a @Resource on a jakarta.jms.Queue or jakarta.jms.Topic member fell through to the generic case and was registered as a resource-env-ref instead of a message-destination-ref, losing the message-destination classification and the usage metadata taken from the mapped name. Use the jakarta.jms and jakarta.resource literals for the message-destination and resource-ref branches. The resource-ref behaviour is unchanged either way because the branch also matches any type ending in ConnectionFactory. --- java/org/apache/catalina/startup/WebAnnotationSet.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/startup/WebAnnotationSet.java b/java/org/apache/catalina/startup/WebAnnotationSet.java index 18417aa057..fe864ffbc6 100644 --- a/java/org/apache/catalina/startup/WebAnnotationSet.java +++ b/java/org/apache/catalina/startup/WebAnnotationSet.java @@ -300,11 +300,11 @@ public class WebAnnotationSet { context.getNamingResources().addService(service); - } else if (type.equals("javax.sql.DataSource") || type.equals("javax.jms.ConnectionFactory") || - type.equals("javax.jms.QueueConnectionFactory") || type.equals("javax.jms.TopicConnectionFactory") || - type.equals("jakarta.mail.Session") || type.equals("java.net.URL") || - type.equals("javax.resource.cci.ConnectionFactory") || type.equals("org.omg.CORBA_2_3.ORB") || - type.endsWith("ConnectionFactory")) { + } else if (type.equals("javax.sql.DataSource") || type.equals("jakarta.jms.ConnectionFactory") || + type.equals("jakarta.jms.QueueConnectionFactory") || + type.equals("jakarta.jms.TopicConnectionFactory") || type.equals("jakarta.mail.Session") || + type.equals("java.net.URL") || type.equals("jakarta.resource.cci.ConnectionFactory") || + type.equals("org.omg.CORBA_2_3.ORB") || type.endsWith("ConnectionFactory")) { // resource-ref element ContextResource resource = new ContextResource(); @@ -325,7 +325,7 @@ public class WebAnnotationSet { context.getNamingResources().addResource(resource); - } else if (type.equals("javax.jms.Queue") || type.equals("javax.jms.Topic")) { + } else if (type.equals("jakarta.jms.Queue") || type.equals("jakarta.jms.Topic")) { // message-destination-ref MessageDestinationRef resource = new MessageDestinationRef(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
