Bug 49956 - @Resource(name=) Normalization of JNDI Name
@Resource(name=) Normalization of JNDI Name
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
trunk
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-09-17 20:15 UTC by Gurkan Erdogdu
Modified: 2010-10-06 17:59 UTC (History)
0 users



Attachments
Resolves issue (2.14 KB, text/plain)
2010-09-17 20:15 UTC, Gurkan Erdogdu
Details

Note You need to log in before you can comment on or make changes to this bug.
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.