Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4101490

The java.net.URL constructor does not allow null file parameter

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



      Name: yyC67448 Date: 12/29/97



      The java.net.URL(String protocol, String host, int port, String file)
      constructor does not allow null file parameter for http and ftp url's.


      Here is the test demonstrating the bug:

      ------------------------ Test.java ---------------------------------------
      import java.net.*;

      public class Test
      {
        public static void main(String args[])
        {
         URL ftp_url = null;
         URL http_url = null;
         String host = "web2.javasoft.com";
         String file = null;
         int port = -1;
         

         try {
           ftp_url = new URL("ftp", host, port, file);
           http_url = new URL("http", host, port, file);
         } catch(MalformedURLException e)
         {
             System.out.println("Passed. OKAY");
             System.exit(0);
         }
         catch(Exception e)
         {
           System.out.println("Unexpected exception:" + e);
           System.exit(-1);
         }

          System.out.println("No exceptions");
          System.exit(-1);
        }
         
      }
      ------------------------- Output from the test ----------------------------
      No exceptions
      ---------------------------------------------------------------------------

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              brenaudsunw Benjamin Renaud (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: