| Commit in servicemix/base/src/main/java/org/servicemix/jbi/util on MAIN | |||
| FileUtil.java | +8 | -5 | 1.5 -> 1.6 |
tidied up delete
servicemix/base/src/main/java/org/servicemix/jbi/util
diff -u -r1.5 -r1.6 --- FileUtil.java 28 Jul 2005 15:08:14 -0000 1.5 +++ FileUtil.java 1 Aug 2005 00:03:40 -0000 1.6 @@ -33,7 +33,7 @@
/** * File utilities *
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class FileUtil {
private static final int DEFAULT_BUFFER_SIZE = 4096;
@@ -95,7 +95,7 @@
* @throws IOException
*/
public static File unpackArchive(File theFile, File targetDir) throws IOException {
- if (!theFile.exists()){
+ if (!theFile.exists()) {
throw new IOException(theFile.getAbsolutePath() + " Does Not Exist!");
}
if (!targetDir.exists()) {
@@ -133,10 +133,10 @@
}
InputStream in = new BufferedInputStream(url.openStream(), DEFAULT_BUFFER_SIZE);
String fileName = url.getFile();
- //make sure we get the actual file
+ // make sure we get the actual file
int index = fileName.lastIndexOf("/");
- if (index > 0 ){
- fileName = fileName.substring(index+1);
+ if (index > 0) {
+ fileName = fileName.substring(index + 1);
}
File zip = new File(targetDir, fileName);
OutputStream out = new BufferedOutputStream(new FileOutputStream(zip));
@@ -217,6 +217,9 @@
}
}
result &= fileToDelete.delete();
+ if (fileToDelete.exists()) {
+ fileToDelete.delete();
+ }
}
return result;
}
