openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1766228 - in /openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache: catalina/startup/MicrowaveContextConfig.java microwave/io/IO.java
Date Sat, 22 Oct 2016 19:39:53 GMT
Author: rmannibucau
Date: Sat Oct 22 19:39:53 2016
New Revision: 1766228

URL: http://svn.apache.org/viewvc?rev=1766228&view=rev
Log:
final fix for scanning

Modified:
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/io/IO.java

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java?rev=1766228&r1=1766227&r2=1766228&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/catalina/startup/MicrowaveContextConfig.java
Sat Oct 22 19:39:53 2016
@@ -94,8 +94,9 @@ public class MicrowaveContextConfig exte
     protected void processAnnotationsWebResource(final WebResource webResource, final WebXml
fragment,
                                                  final boolean handlesTypesOnly,
                                                  final Map<String, JavaClassCacheEntry>
javaClassCache) {
-        if (configuration.isTomcatScanning()) { // TODO: use our finder
-            super.processAnnotationsWebResource(webResource, fragment, handlesTypesOnly,
javaClassCache);
+        if (configuration.isTomcatScanning()) {
+            webClasses.keySet().stream().filter(k -> k.endsWith("/WEB-INF/classes"))
+                    .forEach(k -> processClasses(fragment, handlesTypesOnly, javaClassCache,
k));
         }
     }
 
@@ -105,18 +106,7 @@ public class MicrowaveContextConfig exte
         if (!configuration.isTomcatScanning()) {
             return;
         }
-
-        final Collection<Class<?>> classes = webClasses.remove(url.toExternalForm());
-        if (classes != null && !classes.isEmpty()) {
-            final ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            classes.forEach(c -> {
-                try (final InputStream stream = loader.getResourceAsStream(c.getName().replace('.',
'/') + ".class")) {
-                    super.processAnnotationsStream(stream, fragment, handlesTypesOnly, javaClassCache);
-                } catch (final IOException e) {
-                    new LogFacade(MicrowaveContextConfig.class.getName()).error("Can't parse
" + c);
-                }
-            });
-        }
+        processClasses(fragment, handlesTypesOnly, javaClassCache, url.toExternalForm());
     }
 
     @Override
@@ -154,4 +144,19 @@ public class MicrowaveContextConfig exte
             ok = false;
         }
     }
+
+    private void processClasses(final WebXml fragment, final boolean handlesTypesOnly,
+                                final Map<String, JavaClassCacheEntry> javaClassCache,
final String key) {
+        final Collection<Class<?>> classes = webClasses.remove(key);
+        if (classes != null && !classes.isEmpty()) {
+            final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            classes.forEach(c -> {
+                try (final InputStream stream = loader.getResourceAsStream(c.getName().replace('.',
'/') + ".class")) {
+                    super.processAnnotationsStream(stream, fragment, handlesTypesOnly, javaClassCache);
+                } catch (final IOException e) {
+                    new LogFacade(MicrowaveContextConfig.class.getName()).error("Can't parse
" + c);
+                }
+            });
+        }
+    }
 }

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/io/IO.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/io/IO.java?rev=1766228&r1=1766227&r2=1766228&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/io/IO.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/io/IO.java
Sat Oct 22 19:39:53 2016
@@ -48,7 +48,7 @@ public final class IO {
                     if (f.isFile()) {
                         retryDelete(f);
                     } else {
-                        retryDelete(f);
+                        delete(f);
                     }
                 });
         retryDelete(dir);



Mime
View raw message