[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch: ZipFile.getInputStream shouldn't throw NoSuchElement.
From: |
Anthony Green |
Subject: |
Patch: ZipFile.getInputStream shouldn't throw NoSuchElement. |
Date: |
Tue, 08 Jun 2004 22:46:32 -0700 |
ZipFile.getInputStream shouldn't be throwing NoSuchElement exceptions.
It should be returning null instead.
Found while running Ant 1.6.1 to build JacORB.
This patch applies to both libgcj and classpath. Ok for both?
2004-06-08 Anthony Green <address@hidden>
* java/util/zip/ZipFile.java (getInputStream): Return null if
entry not found.
Index: java/util/zip/ZipFile.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/zip/ZipFile.java,v
retrieving revision 1.24
diff -c -r1.24 ZipFile.java
*** java/util/zip/ZipFile.java 26 Nov 2003 21:55:27 -0000 1.24
--- java/util/zip/ZipFile.java 9 Jun 2004 05:35:33 -0000
***************
*** 409,415 ****
* returned by getEntry() or entries().
*
* @param entry the entry to create an InputStream for.
! * @return the input stream.
*
* @exception IOException if a i/o error occured.
* @exception ZipException if the Zip archive is malformed.
--- 409,415 ----
* returned by getEntry() or entries().
*
* @param entry the entry to create an InputStream for.
! * @return the input stream, or null if the requested entry does not exist.
*
* @exception IOException if a i/o error occured.
* @exception ZipException if the Zip archive is malformed.
***************
*** 420,426 ****
String name = entry.getName();
ZipEntry zipEntry = (ZipEntry) entries.get(name);
if (zipEntry == null)
! throw new NoSuchElementException(name);
long start = checkLocalHeader(zipEntry);
int method = zipEntry.getMethod();
--- 420,426 ----
String name = entry.getName();
ZipEntry zipEntry = (ZipEntry) entries.get(name);
if (zipEntry == null)
! return null;
long start = checkLocalHeader(zipEntry);
int method = zipEntry.getMethod();
AG
--
Anthony Green <address@hidden>
Red Hat, Inc.