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

drastic API change in URLConnection, preventing backward compatability

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.1.7
    • 1.1.6
    • docs
    • b01
    • generic
    • generic
    • Not verified



      Name: diC59631 Date: 05/28/98


      writing any content handler, which use a class that extends URLConnection and uses a FileNameMap.
      The previous API (upto jdk1.1.5) states a public static FileNameMap fileNameMap,
      The new API (jdk1.1.6) state no such variable, but the use of a "new" method, public void setFileNameMap(FileNameMap fnm).
      Not only is this not documented, but provides zero compatability between the different compilers and virtual machines.

      --
      public class ExtendURLConnection extends URLConnection
          implements FileNameMap {

        protected ExtendURLConnection(URL url)
            throws MalformedURLException, IOException {
          
          super(url);
          //fileNameMap = this; /*used to use this*/
          setFileNameMap(this); /*now have to use this*/
        }

        public String getContentTypeFor(String filename) {
          return "unknown";
        }
      }
      --

      running jdk1.1.6 code on jdk1.1.5
      java.lang.NoSuchMethodError: java.net.URLConnection: method setFileNameMap(Ljava/net/FileNameMap;)V not found
              at <package>.ExtendURLConnection.<init>(ExtendURLConnection.java:16)
              at <package>.Handler.openConnection(Handler.java:16)
              at java.net.URL.openConnection(URL.java)
              at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:87)
              at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:96)
              at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:259)
              at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:151)
              at sun.awt.image.ImageFetcher.run(ImageFetcher.java:127)

      running jdk1.1.5 code on jdk1.1.6 gives no errors
      (Review ID: 32592)
      ======================================================================

            irabinovsunw Isaac Rabinovitch (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: