Bug 49956

Summary: @Resource(name=) Normalization of JNDI Name
Product: Tomcat 7 Reporter: Gurkan Erdogdu <gurkanerdogdu>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Resolves issue

Description Gurkan Erdogdu 2010-09-17 20:15:03 UTC
Created attachment 26048 [details]
Resolves issue

name attribute of @Resource defines JNDI name of the resource that binds the resource to web component java:comp/env/. 

java:comp/env/bla..bla.. could be given as a JNDI name. Therefore before using name in DefaultInstanceManager to inject fields & methods, it must be normalized.

For example, 
@Resource(name="java:comp/env/myDataSource") 
DataSource ds;

Before looking up "context.lookup(name)" in DefaultInstanceManager, we have to normalize name to "myDataSource".

Patch is attached
Comment 1 Mark Thomas 2010-10-06 17:59:45 UTC
Thanks for the patch.

I applied the indentation changes as a separate fix so the actual patch was cleaner.

I also had to tweak the patch since the return value from normalize was ignored.

The fix has been applied to trunk and will be included in 7.0.4 onwards.