openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1493338 - in /openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone: OwbArquillianScannerService.java OwbLifecycleHandler.java
Date Sat, 15 Jun 2013 10:28:14 GMT
Author: arne
Date: Sat Jun 15 10:28:13 2013
New Revision: 1493338

URL: http://svn.apache.org/r1493338
Log:
OWB-846: Fixed NullPointerException and type of Archive

Modified:
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java

Modified: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java?rev=1493338&r1=1493337&r2=1493338&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianScannerService.java
Sat Jun 15 10:28:13 2013
@@ -33,7 +33,11 @@ import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.ArchivePath;
 import org.jboss.shrinkwrap.api.Filters;
 import org.jboss.shrinkwrap.api.Node;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.asset.ArchiveAsset;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.FileAsset;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 
@@ -149,9 +153,22 @@ public class OwbArquillianScannerService
         Map<ArchivePath, Node> jars = archive.getContent(Filters.include("/WEB-INF/lib/.*\\.jar"));
         for (Map.Entry<ArchivePath, Node> jarEntry : jars.entrySet())
         {
-            ArchiveAsset archiveAsset = (ArchiveAsset) jarEntry.getValue().getAsset();
-            JavaArchive jarArchive = (JavaArchive) archiveAsset.getArchive();
-            scanJarArchive(jarArchive);
+            Asset asset = jarEntry.getValue().getAsset();
+            if (asset instanceof FileAsset)
+            {
+                FileAsset fileAsset = (FileAsset) asset;
+                if (fileAsset.getSource().getName().endsWith(".jar"))
+                {
+                    Archive<?> fileArchive = ShrinkWrap.createFromZipFile(JavaArchive.class,
fileAsset.getSource());
+                    asset = new ArchiveAsset(fileArchive, ZipExporter.class);
+                }
+            }
+            if (asset instanceof ArchiveAsset)
+            {
+                ArchiveAsset archiveAsset = (ArchiveAsset) asset;
+                JavaArchive jarArchive = (JavaArchive) archiveAsset.getArchive();
+                scanJarArchive(jarArchive);
+            }
         }
 
     }

Modified: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java?rev=1493338&r1=1493337&r2=1493338&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbLifecycleHandler.java
Sat Jun 15 10:28:13 2013
@@ -59,7 +59,14 @@ public class OwbLifecycleHandler
 
     public void beforeMethod(@Observes Before event)
     {
-        ContextsService service = lifecycle.get().getContextService();
+        ContainerLifecycle lc = lifecycle.get();
+        if (lc == null)
+        {
+            // this may happen if there was a DeploymentError during CDI boot
+            return;
+        }
+
+        ContextsService service = lc.getContextService();
 
         service.startContext(RequestScoped.class, null);
         service.startContext(SessionScoped.class, null);



Mime
View raw message