Author: markt
Date: Fri Jan 13 20:45:16 2012
New Revision: 1231290
URL: http://svn.apache.org/viewvc?rev=1231290&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52461
Don't assume file based URLs when checking last modified times for
global and host level web.xml files
Patch provided by violetagg
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1231290&r1=1231289&r2=1231290&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Jan 13
20:45:16 2012
@@ -14,11 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina.startup;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -29,7 +26,6 @@ import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
@@ -111,9 +107,7 @@ import org.xml.sax.SAXParseException;
* @author Jean-Francois Arcand
* @version $Id$
*/
-
-public class ContextConfig
- implements LifecycleListener {
+public class ContextConfig implements LifecycleListener {
private static final Log log = LogFactory.getLog( ContextConfig.class );
@@ -1325,18 +1319,22 @@ public class ContextConfig
if (globalWebXml != null) {
try {
- File f = new File(new URI(globalWebXml.getSystemId()));
- globalTimeStamp = f.lastModified();
- } catch (URISyntaxException e) {
+ URL url = new URL(globalWebXml.getSystemId());
+ globalTimeStamp = url.openConnection().getLastModified();
+ } catch (MalformedURLException e) {
+ globalTimeStamp = -1;
+ } catch (IOException e) {
globalTimeStamp = -1;
}
}
if (hostWebXml != null) {
try {
- File f = new File(new URI(hostWebXml.getSystemId()));
- hostTimeStamp = f.lastModified();
- } catch (URISyntaxException e) {
+ URL url = new URL(hostWebXml.getSystemId());
+ hostTimeStamp = url.openConnection().getLastModified();
+ } catch (MalformedURLException e) {
+ hostTimeStamp = -1;
+ } catch (IOException e) {
hostTimeStamp = -1;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]