cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1056510 - in /cxf/branches/2.3.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletContextResourceResolver.java
Date Fri, 07 Jan 2011 21:10:43 GMT
Author: dkulp
Date: Fri Jan  7 21:10:43 2011
New Revision: 1056510

URL: http://svn.apache.org/viewvc?rev=1056510&view=rev
Log:
Merged revisions 1056486 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1056486 | dkulp | 2011-01-07 15:18:26 -0500 (Fri, 07 Jan 2011) | 2 lines
  
  Make sure file URL's returned form the ServletContextResourceResolver
  actually resolve to a file.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletContextResourceResolver.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletContextResourceResolver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletContextResourceResolver.java?rev=1056510&r1=1056509&r2=1056510&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletContextResourceResolver.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletContextResourceResolver.java
Fri Jan  7 21:10:43 2011
@@ -19,9 +19,11 @@
 
 package org.apache.cxf.transport.servlet;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -80,21 +82,35 @@ public class ServletContextResourceResol
             }
             try {
                 URL url = servletContext.getResource(entryName);
+                if (url != null
+                    && "file".equals(url.getProtocol())
+                    && !(new File(url.toURI()).exists())) {
+                    url = null;
+                }
                 if (url != null) {
                     urlMap.put(url.toString(), url);
                     return clz.cast(url);
                 }
             } catch (MalformedURLException e) {
                 //fallthrough
+            } catch (URISyntaxException e) {
+                //ignore
             }
             try {
                 URL url = servletContext.getResource("/" + entryName);
+                if (url != null
+                    && "file".equals(url.getProtocol())
+                    && !(new File(url.toURI()).exists())) {
+                    url = null;
+                }
                 if (url != null) {
                     urlMap.put(url.toString(), url);
                     return clz.cast(url);
                 }
             } catch (MalformedURLException e1) {
                 //ignore
+            } catch (URISyntaxException e) {
+                //ignore
             }
         } else if (clz.isAssignableFrom(InputStream.class)) {
             return clz.cast(getAsStream(entryName));



Mime
View raw message