Author: scabanovich
Date: 2007-09-03 07:23:34 -0400 (Mon, 03 Sep 2007)
New Revision: 3418
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
Log:
JBIDE-841
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2007-09-03
11:04:36 UTC (rev 3417)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2007-09-03
11:23:34 UTC (rev 3418)
@@ -393,12 +393,15 @@
if(entry != null) jos.closeEntry();
}
- public static void copy(InputStream f, OutputStream t) throws Exception {
- byte[] b = new byte[1024];
- int q = 0;
- while((q = f.read(b, 0, b.length)) > 0) t.write(b, 0, q);
- f.close();
- t.close();
+ public static void copy(InputStream f, OutputStream t) throws IOException {
+ try {
+ byte[] b = new byte[1024];
+ int q = 0;
+ while((q = f.read(b, 0, b.length)) > 0) t.write(b, 0, q);
+ } finally {
+ f.close();
+ t.close();
+ }
}
public static void unzip(File dest, String jar) throws Exception {
@@ -517,7 +520,10 @@
try {
try {
if(f.isFile() && !isSameFile(f)) f.delete();
- if(!f.exists()) f.createNewFile();
+ if(!f.exists()) {
+ f.getParentFile().mkdirs();
+ f.createNewFile();
+ }
} catch (IOException e) {
CommonPlugin.getPluginLog().logError(e);
}
Show replies by date