This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new d23b7cd  OWB-1398 filter only once
d23b7cd is described below

commit d23b7cdc039608deb1d98e3a57d63aca13249331
Author: Thomas Andraschko <[email protected]>
AuthorDate: Mon Dec 13 13:47:13 2021 +0100

    OWB-1398 filter only once
---
 .../corespi/scanner/AbstractMetaDataDiscovery.java  | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
 
b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
index 40ef8d0..812c915 100644
--- 
a/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
+++ 
b/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
@@ -60,9 +60,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.stream.Collectors;
-
-
 
 public abstract class AbstractMetaDataDiscovery implements BdaScannerService
 {
@@ -261,7 +258,12 @@ public abstract class AbstractMetaDataDiscovery implements 
BdaScannerService
             {
                 // third step: remove all jars we know they do not contain any 
CDI beans
                 filterExcludedJars(classPathUrls);
-                classpathFiles = filterExcludedJars(classpathFiles);
+                if (classpathFiles != null)
+                {
+                    classpathFiles = classpathFiles.entrySet().stream()
+                            .filter(e -> classPathUrls.contains(e.getValue()))
+                            .collect(toMap(Map.Entry::getKey, 
Map.Entry::getValue));
+                }
 
                 // forth step: add all 'implicit bean archives'
                 for (URL url : (classpathFiles == null ? classPathUrls : 
classpathFiles.values()))
@@ -313,17 +315,6 @@ public abstract class AbstractMetaDataDiscovery implements 
BdaScannerService
         return urlPath;
     }
 
-    protected Map<File, URL> filterExcludedJars(Map<File, URL> classpathFiles)
-    {
-        if (classpathFiles == null)
-        {
-            return null;
-        }
-        return classpathFiles.entrySet().stream()
-                .filter(e -> !isExcludedJar(e.getValue()))
-                .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
-    }
-
     protected void filterExcludedJars(Set<URL> classPathUrls)
     {
         classPathUrls.removeIf(i -> isExcludedJar(i));

Reply via email to