Author: rmannibucau
Date: Mon Aug 13 08:18:18 2012
New Revision: 1372308

URL: http://svn.apache.org/viewvc?rev=1372308&view=rev
Log:
TOMEE-366 we create a fake folder so easier to delete it directly

Modified:
    
openejb/trunk/openejb/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java

Modified: 
openejb/trunk/openejb/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java?rev=1372308&r1=1372307&r2=1372308&view=diff
==============================================================================
--- 
openejb/trunk/openejb/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
 (original)
+++ 
openejb/trunk/openejb/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEContainer.java
 Mon Aug 13 08:18:18 2012
@@ -209,22 +209,27 @@ public abstract class TomEEContainer<Con
 
             archive.as(ZipExporter.class).exportTo(file, true);
 
-            final AppInfo appInfo = deployer().deploy(file.getAbsolutePath());
-
-            if (options.get("tomee.appinfo.output", false)) {
-                Info.marshal(appInfo);
-            }
-
-            moduleIds.put(archive.getName(), new DeployedApp(appInfo.path, 
file));
-
             final String fileName = file.getName();
-            if (fileName.endsWith(".war")) {
+            if (fileName.endsWith(".war")) { // ??
                 File extracted = new File(file.getParentFile(), 
fileName.substring(0, fileName.length() - 4));
                 if (extracted.exists()) {
                     extracted.deleteOnExit();
                 }
             }
 
+            final AppInfo appInfo;
+            try {
+                appInfo = deployer().deploy(file.getAbsolutePath());
+                moduleIds.put(archive.getName(), new DeployedApp(appInfo.path, 
file.getParentFile()));
+            } catch (RuntimeException re) { // clean up in undeploy needs it
+                moduleIds.put(archive.getName(), new 
DeployedApp(file.getPath(), file.getParentFile()));
+                throw re;
+            }
+
+            if (options.get("tomee.appinfo.output", false)) {
+                Info.marshal(appInfo);
+            }
+
             HTTPContext httpContext = new HTTPContext(configuration.getHost(), 
configuration.getHttpPort());
 
             String arquillianServlet;
@@ -267,7 +272,7 @@ public abstract class TomEEContainer<Con
             deployer().undeploy(deployed.path);
         } catch (Exception e) {
             e.printStackTrace();
-            throw new DeploymentException("Unable to undeploy", e);
+            throw new DeploymentException("Unable to undeploy " + 
archive.getName(), e);
         } finally {
             Files.delete(deployed.file); // "i" folder
 


Reply via email to