servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r382735 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
Date Fri, 03 Mar 2006 09:28:49 GMT
Author: gnodet
Date: Fri Mar  3 01:28:48 2006
New Revision: 382735

URL: http://svn.apache.org/viewcvs?rev=382735&view=rev
Log:
Fix problem when using a url with parameters to download the file

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java?rev=382735&r1=382734&r2=382735&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
Fri Mar  3 01:28:48 2006
@@ -107,7 +107,7 @@
      */
     public static File unpackArchive(File theFile, File targetDir) throws IOException {
         if (!theFile.exists()) {
-            throw new IOException(theFile.getAbsolutePath() + " does Not Exist!");
+            throw new IOException(theFile.getAbsolutePath() + " does not exist");
         }
         if (!targetDir.exists()) {
             targetDir.mkdirs();
@@ -141,13 +141,8 @@
             targetDir.mkdirs();
         }
         InputStream in = new BufferedInputStream(url.openStream(), DEFAULT_BUFFER_SIZE);
-        String fileName = url.getFile();
         // make sure we get the actual file
-        int index = fileName.lastIndexOf("/");
-        if (index > 0) {
-            fileName = fileName.substring(index + 1);
-        }
-        File zip = new File(targetDir, fileName);
+        File zip = File.createTempFile("arc", ".zip", targetDir);
         OutputStream out = new BufferedOutputStream(new FileOutputStream(zip));
         copyInputStream(in, out);
         out.close();



Mime
View raw message