javax.net.ssl.SSLHandshakeException.getMessage()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javax.net.ssl.SSLHandshakeException.getMessage()方法的一些代码示例,展示了SSLHandshakeException.getMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLHandshakeException.getMessage()方法的具体详情如下:
包路径:javax.net.ssl.SSLHandshakeException
类名称:SSLHandshakeException
方法名:getMessage

SSLHandshakeException.getMessage介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

private void testConnection(URL url) throws IOException {
    try {
      URLConnection connection = (URLConnection) ProxyConfiguration.open(url);
      if(connection instanceof HttpURLConnection) {
        int responseCode = ((HttpURLConnection)connection).getResponseCode();
        if(HttpURLConnection.HTTP_OK != responseCode) {
          throw new HttpRetryException("Invalid response code (" + responseCode + ") from URL: " + url, responseCode);
        }
      } else {
        try (InputStream is = connection.getInputStream()) {
          IOUtils.copy(is, new NullOutputStream());
        }
      }
    } catch (SSLHandshakeException e) {
      if (e.getMessage().contains("PKIX path building failed"))
        // fix up this crappy error message from JDK
        throw new IOException("Failed to validate the SSL certificate of "+url,e);
    }
  }
}

代码示例来源:origin: loklak/loklak_server

} catch (SSLHandshakeException e){
  request.reset();
  throw new IOException("client connection handshake error for domain " + request.getURI().getHost() + ": " + e.getMessage());
} catch (Throwable e) {
  request.reset();

代码示例来源:origin: yacy/yacy_grid_mcp

} catch (SSLHandshakeException e){
  this.request.releaseConnection();
  throw new IOException("client connection handshake error for domain " + this.request.getURI().getHost() + ": " + e.getMessage());

代码示例来源:origin: org.mule.modules/mule-module-http

protected void handleSSLException(SSLHandshakeException e)
{
  logger.error("SSL handshake error: " + e.getMessage());
}

代码示例来源:origin: apache/cloudstack

/**
 * This intializes a new jersey restclient for http call with elasticenter
 */
public static ElastiCenterClient getElastistorRestClient() {
  ElastiCenterClient restclient = null;
  try {
    String ip = getConfigurationDao().getValue("cloudbyte.management.ip");
    String apikey = getConfigurationDao().getValue("cloudbyte.management.apikey");
    if (ip == null) {
      throw new CloudRuntimeException("set the value of cloudbyte.management.ip in global settings");
    }
    if (apikey == null) {
      throw new CloudRuntimeException("set the value of cloudbyte.management.apikey in global settings");
    }
    restclient = new ElastiCenterClient(ip, apikey);
  } catch (InvalidCredentialsException e) {
    throw new CloudRuntimeException("InvalidCredentialsException:" + e.getMessage(), e);
  } catch (InvalidParameterException e) {
    throw new CloudRuntimeException("InvalidParameterException:" + e.getMessage(), e);
  } catch (SSLHandshakeException e) {
    throw new CloudRuntimeException("SSLHandshakeException:" + e.getMessage(), e);
  } catch (ServiceUnavailableException e) {
    throw new CloudRuntimeException("ServiceUnavailableException:" + e.getMessage(), e);
  }
  return restclient;
}

代码示例来源:origin: com.minlia.cross/minlia-cross

public SSLSocket connectSSL() {
 SSLSocket sslSocket1=null;
 if (sf == null) {
  try {
   sf = trustAllSocketFactory();
  } catch (Exception e1) {
   e1.printStackTrace();
  }
 }
 try {
  sslSocket1 = (SSLSocket) sf.createSocket(this.serveraddr, this.serverport);
 } catch (UnknownHostException e) {
  log.debug("Error with UnknownHostException {}",e.getMessage());
 } catch (IOException e) {
  log.debug("Error with IOException {}",e.getMessage());
 }
 try {
  sslSocket1.startHandshake();
 } catch (SSLHandshakeException e) {
  log.debug("Error with SSLHandshakeException {}",e.getMessage());
 } catch (IOException e) {
  log.debug("Error with IOException {}",e.getMessage());
 }
 sslSocket=sslSocket1;
 return sslSocket;
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private void parseZip(ResourcesRepository repo, URI jar, File go)
  throws IOException, MalformedURLException, URISyntaxException, ZipException {
  String base = jar.toString() + "!/";
  IO.copy(jar.toURL(), go);
  try (ZipFile zip = new ZipFile(go)) {
    for (ZipEntry entry : Iterables.iterable(zip.entries())) {
      String entryName = entry.getName();
      if (entryName.endsWith(".jar")) {
        parse(repo, new URI(base + entryName));
      }
    }
  } catch (javax.net.ssl.SSLHandshakeException e) {
    error("Failed to open URL due to ssl verification shit: %s %s", jar, e.getMessage());
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.repository

private void parseZip(ResourcesRepository repo, URI jar, File go)
  throws IOException, MalformedURLException, URISyntaxException, ZipException {
  String base = jar.toString() + "!/";
  IO.copy(jar.toURL(), go);
  try (ZipFile zip = new ZipFile(go)) {
    for (ZipEntry entry : Iterables.iterable(zip.entries())) {
      String entryName = entry.getName();
      if (entryName.endsWith(".jar")) {
        parse(repo, new URI(base + entryName));
      }
    }
  } catch (javax.net.ssl.SSLHandshakeException e) {
    error("Failed to open URL due to ssl verification shit: %s %s", jar, e.getMessage());
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private void testConnection(URL url) throws IOException {
    try {
      URLConnection connection = (URLConnection) ProxyConfiguration.open(url);
      if(connection instanceof HttpURLConnection) {
        int responseCode = ((HttpURLConnection)connection).getResponseCode();
        if(HttpURLConnection.HTTP_OK != responseCode) {
          throw new HttpRetryException("Invalid response code (" + responseCode + ") from URL: " + url, responseCode);
        }
      } else {
        try (InputStream is = connection.getInputStream()) {
          IOUtils.copy(is, new NullOutputStream());
        }
      }
    } catch (SSLHandshakeException e) {
      if (e.getMessage().contains("PKIX path building failed"))
        // fix up this crappy error message from JDK
        throw new IOException("Failed to validate the SSL certificate of "+url,e);
    }
  }
}

代码示例来源:origin: spoofzu/DeepViolet

/**
 * Assign the certificate chain to this certificate.
 * @throws DVException Thrown on problems
 */
private void assignCertificateChain() throws DVException {
    try {
      chain = CipherSuiteUtil.getServerCertificateChain(eng.getDVSession().getURL());
    } catch (SSLHandshakeException e ) {
      if( e.getMessage().indexOf("PKIX") > 0 ) {
        String msg = "Certificate chain failed validation. err=" + e.getMessage();
        logger.error(msg,e);
        throw new DVException(msg,e);
      }else{
        String msg = "SSLHandshakeException. err=" + e.getMessage();
        logger.error(msg,e);
        throw new DVException(msg,e);
      }
        
    } catch (Exception e) {
      String msg = "Problem fetching certificates. err=" + e.getMessage();
      logger.error(msg,e);
      throw new DVException(msg,e);
    }
    
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

private void testConnection(URL url) throws IOException {
    try {
      Util.copyStreamAndClose(ProxyConfiguration.open(url).getInputStream(),new NullOutputStream());
    } catch (SSLHandshakeException e) {
      if (e.getMessage().contains("PKIX path building failed"))
        // fix up this crappy error message from JDK
        throw new IOException2("Failed to validate the SSL certificate of "+url,e);
    }
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

private void testConnection(URL url) throws IOException {
    try {
      Util.copyStreamAndClose(ProxyConfiguration.open(url).getInputStream(), new NullOutputStream());
    } catch (SSLHandshakeException e) {
      if (e.getMessage().contains("PKIX path building failed")) // fix up this illegible error message from JDK
      {
        throw new IOException2("Failed to validate the SSL certificate of " + url, e);
      }
    }
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

private void testConnection(URL url) throws IOException {
    try {
      Util.copyStreamAndClose(ProxyConfiguration.open(url).getInputStream(),new NullOutputStream());
    } catch (SSLHandshakeException e) {
      if (e.getMessage().contains("PKIX path building failed"))
        // fix up this illegible error message from JDK
        throw new IOException2("Failed to validate the SSL certificate of "+url,e);
    }
  }
}

代码示例来源:origin: hudson/hudson-2.x

private void testConnection(URL url) throws IOException {
    try {
      Util.copyStreamAndClose(ProxyConfiguration.open(url).getInputStream(),new NullOutputStream());
    } catch (SSLHandshakeException e) {
      if (e.getMessage().contains("PKIX path building failed"))
        // fix up this crappy error message from JDK
        throw new IOException2("Failed to validate the SSL certificate of "+url,e);
    }
  }
}

代码示例来源:origin: org.mule.services/mule-service-http

@Override
public NextAction handleRead(FilterChainContext ctx) throws IOException {
 try {
  ctx.getAttributes().setAttribute(HTTPS.getScheme(), true);
  NextAction nextAction = super.handleRead(ctx);
  ctx.getAttributes().setAttribute(SSL_SESSION_ATTRIBUTE_KEY, getSslSession(ctx));
  return nextAction;
 } catch (SSLHandshakeException e) {
  logger.error("SSL handshake error: " + e.getMessage());
  throw e;
 }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

private void parse(ResourcesRepository repo, URI jar) {
  if (!isInteresting(jar.getPath()))
    return;
  try {
    File go = client.build()
      .get()
      .useCache()
      .go(jar);
    if (jar.getPath()
      .endsWith(".jar")) {
      parseJar(repo, jar, go);
    } else {
      parseZip(repo, jar, go);
    }
  } catch (javax.net.ssl.SSLHandshakeException e) {
    error("Failed to open URL due to ssl verification shit: %s %s", jar, e.getMessage());
  } catch (Exception e) {
    exception(e, "failed to parse file %s", jar);
  }
}

代码示例来源:origin: biz.aQute.bnd/biz.aQute.repository

private void parse(ResourcesRepository repo, URI jar) {
  if (!isInteresting(jar.getPath()))
    return;
  try {
    File go = client.build()
      .get()
      .useCache()
      .go(jar);
    if (jar.getPath()
      .endsWith(".jar")) {
      parseJar(repo, jar, go);
    } else {
      parseZip(repo, jar, go);
    }
  } catch (javax.net.ssl.SSLHandshakeException e) {
    error("Failed to open URL due to ssl verification shit: %s %s", jar, e.getMessage());
  } catch (Exception e) {
    exception(e, "failed to parse file %s", jar);
  }
}

代码示例来源:origin: com.bitplan/mediawiki-japi

/**
 * log me in with the configured user
 * 
 * @throws Exception
 */
public void login() throws Exception {
 WikiUser wuser = WikiUser.getUser(getWikiid(), getSiteurl());
 if (wuser == null) {
  throw new Exception(
    "user for " + getWikiid() + "(" + getSiteurl() + ") not configured");
 }
 // wiki.setDebug(true);
 try {
  Login login = login(wuser.getUsername(), wuser.getPassword());
  LOGGER.log(Level.INFO, this.siteurl + this.scriptPath + this.apiPath + ":"
    + login.getResult());
  if (!"Success".equals(login.getResult())) {
   throw new Exception("login for '" + wuser.getUsername() + "' at '"
     + getWikiid() + "(" + this.getSiteurl() + this.getScriptPath()
     + ")' failed: " + login.getResult());
  }
 } catch (javax.net.ssl.SSLHandshakeException she) {
  String msg = "login via SSL  to " + this.getSiteurl() + " failed\n";
  msg += "Exception: " + she.getMessage();
  throw new Exception(msg);
 }
}

代码示例来源:origin: no.difi.oxalis/oxalis-as2

protected TransmissionResponse sendHttpRequest(HttpPost httpPost) throws OxalisTransmissionException {
  Span span = tracer.buildSpan("execute").asChildOf(root).start();
  try (CloseableHttpClient httpClient = httpClientProvider.get()) {
    BasicHttpContext basicHttpContext = new BasicHttpContext();
    basicHttpContext.setAttribute(Constants.PARENT_CONTEXT, span.context());
    CloseableHttpResponse response = httpClient.execute(httpPost, basicHttpContext);
    span.finish();
    return handleResponse(response);
  } catch (HttpHostConnectException e) {
    span.setTag("exception", e.getMessage());
    throw new OxalisTransmissionException("Receiving server does not seem to be running.",
        transmissionRequest.getEndpoint().getAddress(), e);
  } catch (SSLHandshakeException e) {
    span.setTag("exception", e.getMessage());
    throw new OxalisTransmissionException("Possible invalid SSL Certificate at the other end.",
        transmissionRequest.getEndpoint().getAddress(), e);
  } catch (IOException e) {
    span.setTag("exception", String.valueOf(e.getMessage()));
    throw new OxalisTransmissionException(transmissionRequest.getEndpoint().getAddress(), e);
  } finally {
    span.finish();
  }
}

代码示例来源:origin: difi/oxalis

protected TransmissionResponse sendHttpRequest(HttpPost httpPost) throws OxalisTransmissionException {
  Span span = tracer.buildSpan("execute").asChildOf(root).start();
  try (CloseableHttpClient httpClient = httpClientProvider.get()) {
    BasicHttpContext basicHttpContext = new BasicHttpContext();
    basicHttpContext.setAttribute(Constants.PARENT_CONTEXT, span.context());
    CloseableHttpResponse response = httpClient.execute(httpPost, basicHttpContext);
    span.finish();
    return handleResponse(response);
  } catch (SocketTimeoutException e) {
    span.setTag("exception", String.valueOf(e.getMessage()));
    throw new OxalisTransmissionException("Receiving server has not sent anything back within SOCKET_TIMEOUT", transmissionRequest.getEndpoint().getAddress(), e);
  } catch (HttpHostConnectException e) {
    span.setTag("exception", e.getMessage());
    throw new OxalisTransmissionException("Receiving server does not seem to be running.",
        transmissionRequest.getEndpoint().getAddress(), e);
  } catch (SSLHandshakeException e) {
    span.setTag("exception", e.getMessage());
    throw new OxalisTransmissionException("Possible invalid SSL Certificate at the other end.",
        transmissionRequest.getEndpoint().getAddress(), e);
  } catch (IOException e) {
    span.setTag("exception", String.valueOf(e.getMessage()));
    throw new OxalisTransmissionException(transmissionRequest.getEndpoint().getAddress(), e);
  } finally {
    span.finish();
  }
}

相关文章