aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-02-10 02:43:45 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-02-10 02:43:45 +0000
commitcbe24267f985f984d1d0a6d3472a990473a4d4c0 (patch)
tree93906f6d79af424dcd5985d87888c03ab908b55b /libjava/java/util
parent082e25bfb027b1cc0816b5ec4d1328486a6d8069 (diff)
downloadgcc-cbe24267f985f984d1d0a6d3472a990473a4d4c0.zip
gcc-cbe24267f985f984d1d0a6d3472a990473a4d4c0.tar.gz
gcc-cbe24267f985f984d1d0a6d3472a990473a4d4c0.tar.bz2
Connection.java (getJarFile): Open jar file with OPEN_DELETE.
* gnu/java/net/protocol/jar/Connection.java (getJarFile): Open jar file with OPEN_DELETE. * java/util/zip/ZipFile.java (ZipFile): Call deleteOnExit when OPEN_DELETE is used. From-SVN: r94793
Diffstat (limited to 'libjava/java/util')
-rw-r--r--libjava/java/util/zip/ZipFile.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
index 38ec9e6..b2dbe70 100644
--- a/libjava/java/util/zip/ZipFile.java
+++ b/libjava/java/util/zip/ZipFile.java
@@ -1,5 +1,5 @@
/* ZipFile.java --
- Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,8 +117,6 @@ public class ZipFile implements ZipConstants
*
* The contents of the zip file will be accessible until it is closed.
*
- * The OPEN_DELETE mode is currently unimplemented in this library
- *
* @since JDK1.3
* @param mode Must be one of OPEN_READ or OPEN_READ | OPEN_DELETE
*
@@ -128,11 +126,10 @@ public class ZipFile implements ZipConstants
*/
public ZipFile(File file, int mode) throws ZipException, IOException
{
+ if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE))
+ throw new IllegalArgumentException("invalid mode");
if ((mode & OPEN_DELETE) != 0)
- {
- throw new IllegalArgumentException
- ("OPEN_DELETE mode not supported yet in java.util.zip.ZipFile");
- }
+ file.deleteOnExit();
this.raf = new RandomAccessFile(file, "r");
this.name = file.getPath();
}