tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: using getCanonicalFile when we can
Date Thu, 05 Mar 2015 18:32:48 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop bdce294a1 -> 700dc59ad


using getCanonicalFile when we can


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/700dc59a
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/700dc59a
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/700dc59a

Branch: refs/heads/develop
Commit: 700dc59ade9a42a8333af36c3a6aa5f21869596b
Parents: bdce294
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Thu Mar 5 19:32:34 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Thu Mar 5 19:32:34 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/tomee/catalina/Contexts.java  | 13 +++++++++++--
 .../org/apache/tomee/catalina/TomcatWebAppBuilder.java | 13 +++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/700dc59a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
index bd5c13a..2ca6ac6 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
@@ -26,6 +26,7 @@ import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.util.ContextName;
 
 import java.io.File;
+import java.io.IOException;
 
 public class Contexts {
     public static String getHostname(final StandardContext ctx) {
@@ -50,10 +51,18 @@ public class Contexts {
         if (!file.isDirectory() && name.endsWith(".war")) {
             final File extracted = new File(file.getParentFile(), name.substring(0, name.length()
- ".war".length()));
             if (extracted.exists()) {
-                return extracted;
+                try {
+                    return extracted.getCanonicalFile();
+                } catch (final IOException e) {
+                    return extracted;
+                }
             }
         }
-        return file;
+        try {
+            return file.getCanonicalFile();
+        } catch (final IOException e) {
+            return file;
+        }
     }
 
     public static File realWarPath(final Context standardContext) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/700dc59a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
index 0bfe3c2..82beba6 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
@@ -1367,9 +1367,18 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
 
     private static File rootPath(final File file) {
         if (file.isDirectory() && file.getName().equals("classes") && file.getParentFile()
!= null && file.getParentFile().getName().equals("WEB-INF")) {
-            return file.getParentFile().getParentFile();
+            final File parentFile = file.getParentFile().getParentFile();
+            try {
+                return parentFile.getCanonicalFile();
+            } catch (final IOException e) {
+                return parentFile;
+            }
+        }
+        try {
+            return file.getCanonicalFile();
+        } catch (final IOException e) {
+            return file;
         }
-        return file;
     }
 
     private static void deployWebServicesIfEjbCreatedHere(final AppInfo info, final Collection<BeanContext>
beanContexts) {


Mime
View raw message