Object lookedupResource;
boolean accessibility;
- if ((name != null) &&
- (name.length() > 0)) {
- lookedupResource = context.lookup(name);
+ String normalizedName = normalize(name);
+
+ if ((normalizedName != null) && (normalizedName.length() > 0)) {
+ lookedupResource = context.lookup(normalizedName);
} else {
lookedupResource =
context.lookup(clazz.getName() + "/" + field.getName());
Object lookedupResource;
boolean accessibility;
- if ((name != null) &&
- (name.length() > 0)) {
- lookedupResource = context.lookup(name);
+ String normalizedName = normalize(name);
+
+ if ((normalizedName != null) && (normalizedName.length() > 0)) {
+ lookedupResource = context.lookup(normalizedName);
} else {
lookedupResource = context.lookup(
clazz.getName() + "/" + getName(method));
return name.toString();
}
+
+ private static String normalize(String jndiName){
+ if(jndiName != null && jndiName.startsWith("java:comp/env/")){
+ return jndiName.substring(14);
+ }
+ return jndiName;
+ }
}
<bug>49952</bug>: Allow ServletContainerInitializers to add listeners to
a web application. Patch provided by David Jencks. (markt)
</fix>
+ <fix>
+ <bug>49956</bug>: Handle case when @Resource annotation uses the full
+ JNDI name for a resource. Based on a patch by Gurkan Erdogdu. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">