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

ValidatorException thrown while connecting to https://api.whichbrowser.net/

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • 8u101, 9
    • 8, 9
    • security-libs
    • None

    Description

      ==================================SAMPLE CODE ==========================================
      import java.net.*;
      import java.io.*;

      public class HttpSample {
          public static void main(String[] args) throws Exception {
              URL test = new URL("https://api.whichbrowser.net");
              URLConnection yc = test.openConnection();
              BufferedReader in = new BufferedReader(
                                      new InputStreamReader(
                                      yc.getInputStream()));
              String inputLine;

              while ((inputLine = in.readLine()) != null)
                  System.out.println(inputLine);
              in.close();
          }
      }

      ==================================SAMPLE CODE ==========================================

      Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.ssl.Alerts.getSSLException(Alerts.java:198)
      at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1948)
      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:309)
      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:303)
      at sun.security.ssl.ClientHandshaker.checkServerCerts(ClientHandshaker.java:1841)
      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1650)
      at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:260)
      at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1003)
      at sun.security.ssl.Handshaker.processRecord(Handshaker.java:937)
      at sun.security.ssl.SSLSocketImpl.processInputRecord(SSLSocketImpl.java:1118)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1055)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:966)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1381)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1408)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1392)
      at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:235)
      at HttpSample.main(HttpSample.java:14)

      Attachments

        Issue Links

          Activity

            People

              jnimeh Jamil Nimeh
              arajkumar Arunprasad Rajkumar
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: