Merge branch '5.3.x'

This commit is contained in:
Brian Clozel
2022-09-26 22:27:53 +02:00
6 changed files with 99 additions and 67 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -139,10 +139,15 @@ public class ServletContextResource extends AbstractFileResolvingResource implem
return true;
}
else {
return (this.servletContext.getRealPath(this.path) != null);
String realPath = this.servletContext.getRealPath(this.path);
if (realPath == null) {
return false;
}
File file = new File(realPath);
return (file.exists() && file.isFile());
}
}
catch (MalformedURLException ex) {
catch (IOException ex) {
return false;
}
}