openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject svn commit: r1705018 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
Date Thu, 24 Sep 2015 09:01:25 GMT
Author: tandraschko
Date: Thu Sep 24 09:01:25 2015
New Revision: 1705018

URL: http://svn.apache.org/viewvc?rev=1705018&view=rev
Log:
OWB-1094 possible NPE

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java?rev=1705018&r1=1705017&r2=1705018&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
Thu Sep 24 09:01:25 2015
@@ -253,6 +253,9 @@ public abstract class AbstractMetaDataDi
 
     private int isKnownJar(final String path)
     {
+        // lazy init - required when using DS CdiTestRunner
+        initScanningExcludes();
+
         for (final String p : scanningExcludes)
         {
             final int i = path.indexOf(p);
@@ -305,21 +308,29 @@ public abstract class AbstractMetaDataDi
         String usage = WebBeansContext.currentInstance().getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_BDA_BEANSXML_SCANNER);
         isBDAScannerEnabled = Boolean.parseBoolean(usage);
 
-        String scanningExcludesProperty =
-                WebBeansContext.currentInstance().getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.SCAN_EXCLUSION_PATHS);
-        ArrayList<String> scanningExcludesList = new ArrayList<String>();
-        if (scanningExcludesProperty != null)
+        initScanningExcludes();
+    }
+
+    public void initScanningExcludes()
+    {
+        if (scanningExcludes == null)
         {
-            for (String scanningExclude : scanningExcludesProperty.split(","))
+            String scanningExcludesProperty =
+                    WebBeansContext.currentInstance().getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.SCAN_EXCLUSION_PATHS);
+            ArrayList<String> scanningExcludesList = new ArrayList<String>();
+            if (scanningExcludesProperty != null)
             {
-                scanningExclude = scanningExclude.trim();
-                if (!scanningExclude.isEmpty())
+                for (String scanningExclude : scanningExcludesProperty.split(","))
                 {
-                    scanningExcludesList.add(scanningExclude);
+                    scanningExclude = scanningExclude.trim();
+                    if (!scanningExclude.isEmpty())
+                    {
+                        scanningExcludesList.add(scanningExclude);
+                    }
                 }
             }
+            scanningExcludes = scanningExcludesList.toArray(new String[scanningExcludesList.size()]);
         }
-        scanningExcludes = scanningExcludesList.toArray(new String[scanningExcludesList.size()]);
     }
 
     /**



Mime
View raw message