Repository: tomee
Updated Branches:
  refs/heads/master 40f2ab750 -> 5c925fe13


TOMEE-1993 better symbolic links handling for @WebXXX


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

Branch: refs/heads/master
Commit: 5c925fe1390ed0aa14026e8d5290c36ec0785efd
Parents: 40f2ab7
Author: rmannibucau <[email protected]>
Authored: Tue Jan 3 19:50:48 2017 +0100
Committer: rmannibucau <[email protected]>
Committed: Tue Jan 3 19:50:48 2017 +0100

----------------------------------------------------------------------
 .../catalina/startup/OpenEJBContextConfig.java  | 27 +++++++++++++++-----
 1 file changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/5c925fe1/tomee/tomee-catalina/src/main/java/org/apache/catalina/startup/OpenEJBContextConfig.java
----------------------------------------------------------------------
diff --git 
a/tomee/tomee-catalina/src/main/java/org/apache/catalina/startup/OpenEJBContextConfig.java
 
b/tomee/tomee-catalina/src/main/java/org/apache/catalina/startup/OpenEJBContextConfig.java
index 2d2f795..45a490e 100644
--- 
a/tomee/tomee-catalina/src/main/java/org/apache/catalina/startup/OpenEJBContextConfig.java
+++ 
b/tomee/tomee-catalina/src/main/java/org/apache/catalina/startup/OpenEJBContextConfig.java
@@ -565,8 +565,18 @@ public class OpenEJBContextConfig extends ContextConfig {
                 if (webInfClassesAnnotationsProcessed.contains(info.name)) {
                     continue;
                 }
+
                 try {
-                    if (file.getAbsolutePath().startsWith(URLs.toFile(new 
URL(info.name)).getAbsolutePath())) {
+                    boolean doProcess = isIncludedIn(info.name, file);
+                    if (!doProcess) { // for sym links we can need to check 
each file for an exact matching
+                        for (final String path : info.list) {
+                            if (isIncludedIn(path, file)) {
+                                doProcess = true;
+                                break;
+                            }
+                        }
+                    }
+                    if (doProcess) {
                         webInfClassesAnnotationsProcessed.add(info.name);
                         internalProcessAnnotationsStream(info.list, fragment, 
false);
                     }
@@ -708,20 +718,19 @@ public class OpenEJBContextConfig extends ContextConfig {
         }
     }
 
-    private boolean isIncludedIn(final String filePath, final File 
classAsFile) throws MalformedURLException {
-        final File toFile = URLs.toFile(new URL(filePath));
+    private boolean isIncluded(final File root, final File clazz) {
         File file;
         try { // symb links
-            file = toFile.getCanonicalFile();
+            file = root.getCanonicalFile();
         } catch (final IOException e) {
-            file = toFile;
+            file = root;
         }
 
         File current;
         try { // symb links and windows long home names
-            current = classAsFile.getCanonicalFile();
+            current = clazz.getCanonicalFile();
         } catch (final IOException e) {
-            current = classAsFile;
+            current = clazz;
         }
         while (current != null && current.exists()) {
             if (current.equals(file)) {
@@ -736,4 +745,8 @@ public class OpenEJBContextConfig extends ContextConfig {
         return false;
     }
 
+    private boolean isIncludedIn(final String filePath, final File 
classAsFile) throws MalformedURLException {
+        return isIncluded(URLs.toFile(new URL(filePath)), classAsFile);
+    }
+
 }

Reply via email to