JNDI resources that are defined with injection targets but no value are now treated as if the resource is not defined.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc8.0.x/trunk@1831253 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
index 9f1de07..ab90515 100644
--- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java
+++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
@@ -260,6 +260,12 @@
             }
         }
 
+        // Entries with injection targets but no value are effectively ignored
+        if (environment.getInjectionTargets() != null && environment.getInjectionTargets().size() > 0 &&
+                (environment.getValue() == null || environment.getValue().length() == 0)) {
+            return;
+        }
+
         if (!checkResourceType(environment)) {
             throw new IllegalArgumentException(sm.getString(
                     "namingResources.resourceTypeFail", environment.getName(),
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e2b2366..d35d2ca 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -67,6 +67,10 @@
         <code>getProtocol()</code> are not corrupted by the processing of the
         saved request body. (markt)
       </fix>
+      <fix>
+        JNDI resources that are defined with injection targets but no value are
+        now treated as if the resource is not defined. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">