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

"showDocument" of javax.jnlp.BasicService throws NPE

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P3
    • Resolution: Fixed
    • 6
    • 8
    • deploy
    • b33
    • x86
    • windows_vista
    • Verified

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When I try to open some URL using javax.jnlp.BasicService "showDocument" (see attached source code). In most of the cases everything is ok, but not in the following case when server sends "redirect" response like this:
      HTTP/1.1 302 Redirect
      Date: Fri, 23 Oct 2009 16:04:56 GMT
      Server: Microsoft-IIS/6.0
      Location: https://.........................
      Content-Length: 0

      I got the NPE (because this response does not contains "Content-Type").

      I think it is easy to fix, just replace equals in com.sun.deploy.net.DownloadEngine.isJnlpURL
           return httpresponse.getContentType().equals("application/x-java-jnlp-file");
         to
           return "application/x-java-jnlp-file".equals(httpresponse.getContentType());

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to open some URL using "showDocument" of javax.jnlp.BasicService.
        To reproduce this NPE server should send redirect for this URL.

      ACTUAL -
      NPE In a case of getting "redirect" from server.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception:
      Caused by: java.lang.NullPointerException at com.sun.deploy.net.DownloadEngine.isJnlpURL(DownloadEngine.java:750) at com.sun.jnlp.BasicServiceImpl$1.run(BasicServiceImpl.java:150) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jnlp.BasicServiceImpl.showDocumentHelper(BasicServiceImpl.java:147) at com.sun.jnlp.BasicServiceImpl.showDocument(BasicServiceImpl.java:143)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
              try {
                       Class serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
                       Method lookupMethod = serviceManagerClass.getMethod("lookup", new Class[] { String.class });
                       Object basicServiceObject = lookupMethod.invoke(null, new Object[] { "javax.jnlp.BasicService" });
                       Class basicServiceClass = Class.forName("javax.jnlp.BasicService");
                       URL url = new URL("someUrl");
                       Method method = basicServiceClass.getMethod("showDocument", new Class[] { URL.class });
                       Boolean resultBoolean = (Boolean) method.invoke(basicServiceObject, new Object[] { url });
               } catch (Exception e) {
               }

      ---------- END SOURCE ----------

      Attachments

        Activity

          People

            herrick Andy Herrick (Inactive)
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: