Hi,

during running some http tests I found that the testcase
gnu/testlet/java/net/URLConnection/Jar.java is failing.

I added a specialised test to confirm that the FileNotFoundException
needs to be thrown from connect(). Therefore I removed the duplicate
code in getInputStream() as jar_entry cannot be null here.

2006-03-02  Wolfgang Baer  <[EMAIL PROTECTED]>

        * gnu/java/net/protocol/jar/Connection.java:
        (connect): Throw FileNotFoundException.
        (getInputStream): Remove duplicated code.

OK to commit ?

Wolfgang

Index: Connection.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/protocol/jar/Connection.java,v
retrieving revision 1.12
diff -u -r1.12 Connection.java
--- Connection.java	17 Nov 2005 18:00:59 -0000	1.12
+++ Connection.java	2 Mar 2006 18:52:44 -0000
@@ -1,5 +1,5 @@
 /* Connection - jar url connection for java.net
-   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,6 +39,7 @@
 package gnu.java.net.protocol.jar;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -145,7 +146,7 @@
         jar_entry = (JarEntry) jar_file.getEntry (entry_name);
 
         if(jar_entry == null)
-          throw new IOException ("No entry for " + entry_name + " exists.");
+          throw new FileNotFoundException("No entry for " + entry_name + " exists.");
       }
 
     connected = true;
@@ -159,9 +160,6 @@
     if (! doInput)
       throw new ProtocolException("Can't open InputStream if doInput is false");
     
-    if (jar_entry == null)
-      throw new IOException (jar_url + " couldn't be found.");
-    
     return jar_file.getInputStream (jar_entry);
   }
 

Reply via email to