summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gnu/classpath/tools/jar/Updater.java28
1 files changed, 4 insertions, 24 deletions
diff --git a/tools/gnu/classpath/tools/jar/Updater.java b/tools/gnu/classpath/tools/jar/Updater.java
index a719004ed..f25d56fdc 100644
--- a/tools/gnu/classpath/tools/jar/Updater.java
+++ b/tools/gnu/classpath/tools/jar/Updater.java
@@ -71,7 +71,8 @@ public class Updater
inputJar = new JarFile(parameters.archiveFile);
// Write all the new entries to a temporary file.
- File tmpFile = File.createTempFile("jarcopy", null);
+ File tmpFile = File.createTempFile("jarcopy", null,
+ parameters.archiveFile.getParentFile());
OutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile));
writeCommandLineEntries(parameters, os);
@@ -89,30 +90,9 @@ public class Updater
close();
if (!tmpFile.renameTo(parameters.archiveFile))
{
- if (!parameters.archiveFile.delete())
- throw new IOException("Couldn't delete original JAR file " +
- parameters.archiveFile);
- copyFile(tmpFile, parameters.archiveFile);
- tmpFile.delete();
+ throw new IOException("Couldn't rename new JAR file " + tmpFile +
+ "to " + parameters.archiveFile);
}
}
- private void copyFile(File sourceFile, File destFile)
- throws IOException
- {
- BufferedInputStream source =
- new BufferedInputStream(new FileInputStream(sourceFile));
- BufferedOutputStream dest =
- new BufferedOutputStream(new FileOutputStream(destFile));
- int inputByte;
-
- while ((inputByte = source.read()) != -1)
- {
- dest.write(inputByte);
- }
-
- source.close();
- dest.close();
- }
-
}