[gatein-commits] gatein SVN: r5245 - epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 24 07:31:03 EST 2010


Author: thomas.heute at jboss.com
Date: 2010-11-24 07:31:02 -0500 (Wed, 24 Nov 2010)
New Revision: 5245

Modified:
   epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java
Log:
JBEPP-670: Invalid URLs in gadgets generate exceptions


Modified: epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java	2010-11-24 04:20:00 UTC (rev 5244)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java	2010-11-24 12:31:02 UTC (rev 5245)
@@ -57,6 +57,9 @@
    /** . */
    private ServletContext ctx;
 
+   /** . */
+   private static final Logger log = LoggerFactory.getLogger(ProxyServletFilter.class);
+
    public void init(FilterConfig cfg) throws ServletException
    {
       this.ctx = cfg.getServletContext();
@@ -90,14 +93,23 @@
             }
             else
             {
-               URI uri = URI.create(url);
-               if (!service.accept(hreq, container, uri))
+               try
                {
-                  hresp.sendError(HttpServletResponse.SC_FORBIDDEN, "Gadget " + url + " is blacklisted");
+                  URI uri = URI.create(url);
+                  if (!service.accept(hreq, container, uri))
+                  {
+                     hresp.sendError(HttpServletResponse.SC_FORBIDDEN, "Gadget " + url + " is blacklisted");
+                  }
+                  else
+                  {
+                     chain.doFilter(req, resp);
+                  }
+
                }
-               else
+               catch (java.lang.IllegalArgumentException e)
                {
-                  chain.doFilter(req, resp);
+                  // It happens that some URLs can be wrong, I've seen this with "http://" as URL in one of the Google Gadgets
+                  logger.debug("Invalid URL: " + url;
                }
             }
          }



More information about the gatein-commits mailing list