This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: ZipFile.getInputStream shouldn't throw NoSuchElement.


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  <green@redhat.com>

	* 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 <green@redhat.com>
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]