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

The java.net.URLConnection.setFileNameMap allows null map parameter.

XMLWordPrintable

    • sparc
    • solaris_2.5



      Name: yyC67448 Date: 02/23/98



      The java.net.URLConnection.setFileNameMap(FileNameMap map) allows
      null map parameter.

      Method's behavior for null map parameter is not documented.


      Here is the javadoc comments for methods setFileNameMap


          /**
           * Sets the FileNameMap.
           *
           * @param map the FileNameMap to be set
           * @since JDK1.2
           */



      Here is the test demonstrating the bug:

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

      class test
      {
        public static void main(String args[])
        {
          FileNameMap map=null;
         

          try {
             URLConnection.setFileNameMap(map);
          } catch(SecurityException e)
          {
           System.out.println("Passed. Correctly failed to setup test:" + e);
           System.exit(0);
          }
          catch(NullPointerException e)
          {
           System.out.println("Passed. OKAY");
           System.exit(0);
          }
          catch(Exception e)
          {
            System.out.println("Failed. Unexpected exception :" + e);
      System.exit(-1);
          }
              
          System.out.println("Failed. No exceptions.");


        }
         
      }

      ------------------------- Output from the test ----------------------------
      Failed. No exceptions.
      ---------------------------------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: