incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1230926 - /sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
Date Fri, 13 Jan 2012 08:57:09 GMT
Author: cziegeler
Date: Fri Jan 13 08:57:09 2012
New Revision: 1230926

URL: http://svn.apache.org/viewvc?rev=1230926&view=rev
Log:
SLING-2353 : Prevent <sling:include resource="<%= null %>" /> to include itself

Modified:
    sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java

Modified: sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java?rev=1230926&r1=1230925&r2=1230926&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
(original)
+++ sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
Fri Jan 13 08:57:09 2012
@@ -114,6 +114,11 @@ public abstract class AbstractDispatcher
             }
         }
 
+        // prevent useless recursion, we don't need to use equals here(!)
+        if ( resource == request.getResource()
+             && resourceType == null && replaceSelectors == null &&
addSelectors == null && replaceSuffix == null ) {
+            throw new JspTagException("Resource is including itself without changing resource
type, selectors, or suffix!");
+        }
         try {
             // create a dispatcher for the resource or path
             RequestDispatcher dispatcher;
@@ -131,11 +136,11 @@ public abstract class AbstractDispatcher
                 TagUtil.log(log, pageContext, "No content to include...", null);
             }
 
-        } catch (JspTagException jte) {
+        } catch (final JspTagException jte) {
             throw jte;
-        } catch (IOException ioe) {
+        } catch (final IOException ioe) {
             throw new JspTagException(ioe);
-        } catch (ServletException ce) {
+        } catch (final ServletException ce) {
             throw new JspTagException(TagUtil.getRootCause(ce));
         }
 



Mime
View raw message