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

NullPointerException from ntlm.Client.type3

XMLWordPrintable

    • b128
    • x86_64
    • linux
    • Verified

        FULL PRODUCT VERSION :
        java version "1.8.0_65"
        Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
        Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Linux daisy.blackducksoftware.com 2.6.32-573.12.1.el6.x86_64 #1 SMP Tue Dec 15 21:19:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
        and other Linux variants

        A DESCRIPTION OF THE PROBLEM :
        Attempting to create a connection to an NTLM proxy fails with a NullPointerException from the JRE.

        NTLM Client: Type 1 created
        0000: 4E 54 4C 4D 53 53 50 00   01 00 00 00 07 82 08 00  NTLMSSP.........
        0010: 00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ................

        NTLM Client: Type 2 received
        0000: 4E 54 4C 4D 53 53 50 00   02 00 00 00 00 00 00 00  NTLMSSP.........
        0010: 00 00 00 00 05 82 89 00   0B 87 81 B6 2D 6E 8B C1  ............-n..
        0020: 00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ................

        java.lang.RuntimeException: java.lang.NullPointerException
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1455)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
                at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2979)
                at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:489)
                at com.blackduck.proxy.TestProxyHttpUrlConnection.connect(TestProxyHttpUrlConnection.java:43)
                at com.blackduck.proxy.TestProxyHttpUrlConnection.main(TestProxyHttpUrlConnection.java:31)
        Caused by: java.lang.NullPointerException
                at com.sun.security.ntlm.Client.type3(Client.java:161)
                at sun.net.www.protocol.http.ntlm.NTLMAuthentication.buildType3Msg(NTLMAuthentication.java:241)
                at sun.net.www.protocol.http.ntlm.NTLMAuthentication.setHeaders(NTLMAuthentication.java:216)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1607)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
                at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
                ... 2 more

        Inspecting the code Client.type3() assumes that NTLM.readSecurityBuffer will never return null, but it will return null if the optional target information is not present.

        REGRESSION. Last worked in version 7u80

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Connect to an http proxy that returns NTLM challenge data shown above.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The connection attempt should succeed if valid credentials are supplied.
        ACTUAL -
        NullPointerException

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        java.lang.RuntimeException: java.lang.NullPointerException
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1455)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
                at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2979)
                at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:489)
                at com.blackduck.proxy.TestProxyHttpUrlConnection.connect(TestProxyHttpUrlConnection.java:43)
                at com.blackduck.proxy.TestProxyHttpUrlConnection.main(TestProxyHttpUrlConnection.java:31)
        Caused by: java.lang.NullPointerException
                at com.sun.security.ntlm.Client.type3(Client.java:161)
                at sun.net.www.protocol.http.ntlm.NTLMAuthentication.buildType3Msg(NTLMAuthentication.java:241)
                at sun.net.www.protocol.http.ntlm.NTLMAuthentication.setHeaders(NTLMAuthentication.java:216)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1607)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
                at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
                ... 2 more

        REPRODUCIBILITY :
        This bug can be reproduced always.

              vtewari Vyom Tewari
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: