Author: violetagg
Date: Thu May 16 14:16:19 2013
New Revision: 1483385

URL: http://svn.apache.org/r1483385
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54981
Merged revision 1483229 from tomcat/trunk:
ServletContext.getJspConfigDescriptor() must return NULL when there is no jsp 
configuration

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
    
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1483229

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1483385&r1=1483384&r2=1483385&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java 
Thu May 16 14:16:19 2013
@@ -1480,7 +1480,14 @@ public class ApplicationContext
 
     @Override
     public JspConfigDescriptor getJspConfigDescriptor() {
-        return context.getJspConfigDescriptor();
+        JspConfigDescriptor jspConfigDescriptor = context
+                .getJspConfigDescriptor();
+        if (jspConfigDescriptor.getJspPropertyGroups().isEmpty()
+                && jspConfigDescriptor.getTaglibs().isEmpty()) {
+            return null;
+        } else {
+            return jspConfigDescriptor;
+        }
     }
 
 

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java?rev=1483385&r1=1483384&r2=1483385&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java 
Thu May 16 14:16:19 2013
@@ -98,6 +98,25 @@ public class TestApplicationContext exte
     }
 
 
+    @Test
+    public void testGetJspConfigDescriptor() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir = new File("test/webapp-3.0");
+        // app dir is relative to server home
+        StandardContext standardContext = (StandardContext) tomcat.addWebapp(
+                null, "/test", appDir.getAbsolutePath());
+
+        ServletContext servletContext = standardContext.getServletContext();
+
+        Assert.assertNull(servletContext.getJspConfigDescriptor());
+
+        tomcat.start();
+
+        Assert.assertNotNull(servletContext.getJspConfigDescriptor());
+    }
+
+
     private ServletContext getServletContext() {
         Tomcat tomcat = getTomcatInstance();
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1483385&r1=1483384&r2=1483385&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu May 16 14:16:19 2013
@@ -82,6 +82,12 @@
         <code>SessionCookieConfig</code> was acquired has already been
         initialized. (violetagg)
       </fix>
+      <fix>
+        <bug>54981</bug>: Ensure that
+        <code>ServletContext#getJspConfigDescriptor()</code> will return
+        <code>null</code> when there is no jsp configuration provided by
+        web.xml/web-fragment.xml. (violetagg)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to