tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject svn commit: r1239015 - /openejb/trunk/openejb/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
Date Wed, 01 Feb 2012 09:02:42 GMT
Author: andygumbrecht
Date: Wed Feb  1 09:02:41 2012
New Revision: 1239015

URL: http://svn.apache.org/viewvc?rev=1239015&view=rev
Log:
Notify on failure.

Modified:
    openejb/trunk/openejb/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java

Modified: openejb/trunk/openejb/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java?rev=1239015&r1=1239014&r2=1239015&view=diff
==============================================================================
--- openejb/trunk/openejb/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
(original)
+++ openejb/trunk/openejb/utils/openejb-provisionning/src/main/java/org/apache/openejb/resolver/Resolver.java
Wed Feb  1 09:02:41 2012
@@ -30,6 +30,7 @@ import static org.apache.openejb.loader.
 public class Resolver implements LocationResolver {
     public static final String MVN_PREFIX = "mvn:";
 
+    @Override
     public String resolve(final String rawLocation) throws Exception {
         if (rawLocation.startsWith(MVN_PREFIX) && rawLocation.length() > MVN_PREFIX.length())
{
 
@@ -39,13 +40,18 @@ public class Resolver implements Locatio
             if (!file.exists()) {
                 try {
                     final URL url = new URL(MVN_PREFIX.substring(MVN_PREFIX.length() - 1),
"localhost", -1, info, new Handler());
-                    if (!file.getParentFile().exists()) {
-                        file.getParentFile().mkdirs();
+                    final File parentFile = file.getParentFile();
+                    if (!parentFile.exists()) {
+                        if (!parentFile.mkdirs()) {
+                            throw new Exception("Failed to create: " + parentFile);
+                        }
                     }
                     FileUtils.copy(new FileOutputStream(file), url.openStream());
                 } catch (Exception e) {
                     if (file.exists()) {
-                        file.delete();
+                        if (!file.delete()) {
+                            file.deleteOnExit();
+                        }
                     }
                     throw e;
                 }



Mime
View raw message