don't we have Files fo rit?

Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau



---------- Forwarded message ----------
From:  <[email protected]>
Date: 2014-12-03 8:35 GMT+01:00
Subject: tomee git commit: Verbose creation
To: [email protected]


Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 7ce3cb3aa -> f649c2cf6


Verbose creation


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f649c2cf
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f649c2cf
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f649c2cf

Branch: refs/heads/tomee-1.7.x
Commit: f649c2cf68e4a04d362cb4e7d19a4deaac4d80c6
Parents: 7ce3cb3
Author: andygumbrecht <[email protected]>
Authored: Wed Dec 3 08:34:51 2014 +0100
Committer: andygumbrecht <[email protected]>
Committed: Wed Dec 3 08:34:51 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/openejb/loader/ProvisioningUtil.java     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/f649c2cf/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
index b7b033c..f4c4f6d 100644
--- 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
+++ 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ProvisioningUtil.java
@@ -74,8 +74,10 @@ public final class ProvisioningUtil {
     }

     public static File cacheFile(final String path) {
-        File cacheDir = new
File(SystemInstance.get().getBase().getDirectory(), cache());
-        cacheDir.mkdirs();
+        final File cacheDir = new
File(SystemInstance.get().getBase().getDirectory(), cache());
+        if (!cacheDir.exists() && !cacheDir.mkdirs()) {
+            throw new RuntimeException("Failed to create the
directory: " + cacheDir);
+        }
         return new File(cacheDir, path);
     }

@@ -242,7 +244,7 @@ public final class ProvisioningUtil {

         String artifactVersion;
         if (snapshotBase != null &&
snapshotBase.startsWith(HTTP_PREFIX) &&
version.endsWith(SNAPSHOT_SUFFIX)) {
-            final String meta = new
StringBuilder(snapshotBase).append(builder.toString()).append("maven-metadata.xml").toString();
+            final String meta = snapshotBase + builder.toString() +
"maven-metadata.xml";
             final URL url = new URL(meta);
             final ByteArrayOutputStream out = new ByteArrayOutputStream();
             InputStream is = null;

Reply via email to