Author: thomas.heute(a)jboss.com
Date: 2010-11-24 07:35:47 -0500 (Wed, 24 Nov 2010)
New Revision: 5246
Modified:
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java
Log:
GTNPORTAL-1687: Invalid URLs in gadgets generate exceptions
Modified:
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java
===================================================================
---
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java 2010-11-24
12:31:02 UTC (rev 5245)
+++
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java 2010-11-24
12:35:47 UTC (rev 5246)
@@ -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;
}
}
}
Show replies by date