java.net.MalformedURLException.getCause()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(96)

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

MalformedURLException.getCause介绍

暂无

代码示例

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

  1. private URL fileToUrl(File file) {
  2. Validate.notNull(file, "File to get URL of can not be a null object.");
  3. try {
  4. URL url = file.getAbsoluteFile().toURI().toURL();
  5. return url;
  6. } catch (MalformedURLException ex) {
  7. throw new IllegalArgumentException(String.format("Unable to get URL of file %s", file.getAbsolutePath()), ex.getCause());
  8. }
  9. }
  10. }

代码示例来源:origin: arquillian/arquillian-graphene

  1. private URL fileToUrl(File file) {
  2. Validate.notNull(file, "File to get URL of can not be a null object.");
  3. try {
  4. URL url = file.getAbsoluteFile().toURI().toURL();
  5. return url;
  6. } catch (MalformedURLException ex) {
  7. throw new IllegalArgumentException(String.format("Unable to get URL of file %s", file.getAbsolutePath()), ex.getCause());
  8. }
  9. }
  10. }

代码示例来源:origin: gnuhpc/Kafka-zk-restapi

  1. public JMXConnector connect() throws CollectorException {
  2. try {
  3. JMXServiceURL jmxServiceURL = new JMXServiceURL(this.jmxServiceURL);
  4. jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, jmxEnv);
  5. } catch (MalformedURLException e) {
  6. throw new CollectorException(String.format("%s occurred. URL: %s. Reason: %s",
  7. e.getClass().getCanonicalName(), this.jmxServiceURL, e.getCause()), e);
  8. } catch (IOException e) {
  9. throw new CollectorException(String.format("%s occurred. URL: %s. Reason: %s",
  10. e.getClass().getCanonicalName(), this.jmxServiceURL, e.getCause()), e);
  11. }
  12. return jmxConnector;
  13. }

代码示例来源:origin: phax/as2-lib

  1. /**
  2. * Get URL
  3. */
  4. public URL getURL () throws OpenAS2Exception
  5. {
  6. URI uri = null;
  7. try
  8. {
  9. uri = m_aRequestBuilder.getUri ();
  10. return uri.toURL ();
  11. }
  12. catch (final MalformedURLException ex)
  13. {
  14. if (LOGGER.isErrorEnabled ())
  15. LOGGER.error ("Failed to get URL from connection, URI: " + uri.toASCIIString (), ex);
  16. throw new OpenAS2Exception (ex.getCause ());
  17. }
  18. }

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

  1. private String getURLFromLocationWithRoot(String location) {
  2. URL contextRoot = locationStore.get().getURL();
  3. if (contextRoot != null) {
  4. try {
  5. return new URL(contextRoot, location).toExternalForm();
  6. } catch (MalformedURLException ex) {
  7. throw new LocationException("URL to construct is malformed.", ex.getCause());
  8. }
  9. }
  10. throw new LocationException(String.format(
  11. "The location %s is not valid URI and no contextRoot was discovered to treat it as relative URL",
  12. location));
  13. }

代码示例来源:origin: arquillian/arquillian-graphene

  1. private String getURLFromLocationWithRoot(String location) {
  2. URL contextRoot = locationStore.get().getURL();
  3. if (contextRoot != null) {
  4. try {
  5. return new URL(contextRoot, location).toExternalForm();
  6. } catch (MalformedURLException ex) {
  7. throw new LocationException("URL to construct is malformed.", ex.getCause());
  8. }
  9. }
  10. throw new LocationException(String.format(
  11. "The location %s is not valid URI and no contextRoot was discovered to treat it as relative URL",
  12. location));
  13. }

代码示例来源:origin: org.jbpm.jbpm3/jbpm-jbpm4jsf

  1. private void searchWar() {
  2. final String path = "/WEB-INF/jbpm4jsf-config.xml";
  3. final FacesContext facesContext = FacesContext.getCurrentInstance();
  4. final ExternalContext externalContext = facesContext.getExternalContext();
  5. final ServletContext servletContext = (ServletContext) externalContext.getContext();
  6. try {
  7. final URL resource = servletContext.getResource(path);
  8. handleConfiguration(resource);
  9. } catch (MalformedURLException e) {
  10. final FacesException ex = new FacesException("Failed to read configuration resource: " + e.getMessage(), e.getCause());
  11. ex.setStackTrace(e.getStackTrace());
  12. throw ex;
  13. }
  14. }

代码示例来源:origin: org.jenkins-ci.plugins/github-branch-source

  1. } catch (MalformedURLException mue) {
  2. LOGGER.log(Level.WARNING, "Trying to configure a GitHub Enterprise server: " + apiUri, mue.getCause());
  3. return FormValidation.error("The endpoint does not look like a GitHub Enterprise (malformed URL)");
  4. } catch (JsonParseException jpe) {

代码示例来源:origin: org.wso2.carbon.transport/org.wso2.carbon.transport.http.netty

  1. exceptionCaught(ctx, exception.getCause());
  2. } catch (Exception exception) {
  3. LOG.error("Error occurred during redirection", exception);

代码示例来源:origin: org.wso2.carbon.transport/org.wso2.carbon.transport.http.netty

  1. } catch (MalformedURLException exception) {
  2. LOG.error("MalformedURLException occurred when deciding whether a redirection is required", exception);
  3. exceptionCaught(ctx, exception.getCause());

代码示例来源:origin: geoserver/geofence

  1. public void testConnection(org.geoserver.geofence.gui.client.model.GSInstanceModel instance) throws ApplicationException {
  2. try {
  3. String response = getURL(instance.getBaseURL() + "/rest/geofence/info", instance.getUsername(), instance.getPassword());
  4. if(response != null) {
  5. if(!response.equals(instance.getName())) {
  6. if(response.contains("Geoserver Configuration API")) { // some heuristic here
  7. logger.error("GeoFence probe not installed on " + instance.getName());
  8. throw new ApplicationException("GeoFence probe not installed on " + instance.getName());
  9. } else {
  10. logger.error("Wrong instance name: " + response);
  11. throw new ApplicationException("Wrong instance name: " + instance.getName() + ", should be :" + response);
  12. }
  13. }
  14. } else {
  15. throw new ApplicationException("Error contacting GeoServer");
  16. }
  17. } catch (MalformedURLException e) {
  18. logger.error(e.getLocalizedMessage(), e.getCause());
  19. throw new ApplicationException(e.getLocalizedMessage(),
  20. e.getCause());
  21. }
  22. }

代码示例来源:origin: org.opennms/opennms-vmware

  1. vmwareViJavaAccess.connect();
  2. } catch (MalformedURLException e) {
  3. logger.warn("Error connecting VMware management server '{}': '{}' exception: {} cause: '{}'", vmwareManagementServer, e.getMessage(), e.getClass().getName(), e.getCause());
  4. return PollStatus.unavailable("Error connecting VMware management server '" + vmwareManagementServer + "'");
  5. } catch (RemoteException e) {

代码示例来源:origin: OpenNMS/opennms

  1. vmwareViJavaAccess.connect();
  2. } catch (MalformedURLException e) {
  3. logger.warn("Error connecting VMware management server '{}': '{}' exception: {} cause: '{}'", vmwareManagementServer, e.getMessage(), e.getClass().getName(), e.getCause());
  4. return PollStatus.unavailable("Error connecting VMware management server '" + vmwareManagementServer + "'");
  5. } catch (RemoteException e) {

代码示例来源:origin: OpenNMS/opennms

  1. vmwareViJavaAccess.connect();
  2. } catch (MalformedURLException e) {
  3. logger.warn("Error connecting VMware management server '{}': '{}' exception: {} cause: '{}'", vmwareManagementServer, e.getMessage(), e.getClass().getName(), e.getCause());
  4. return builder.build();
  5. } catch (RemoteException e) {

代码示例来源:origin: org.opennms/opennms-vmware

  1. vmwareViJavaAccess.connect();
  2. } catch (MalformedURLException e) {
  3. logger.warn("Error connecting VMware management server '{}': '{}' exception: {} cause: '{}'", vmwareManagementServer, e.getMessage(), e.getClass().getName(), e.getCause());
  4. return builder.build();
  5. } catch (RemoteException e) {

代码示例来源:origin: OpenNMS/opennms

  1. vmwareViJavaAccess.connect();
  2. } catch (MalformedURLException e) {
  3. logger.warn("Error connecting VMware management server '{}': '{}' exception: {} cause: '{}'", vmwareManagementServer, e.getMessage(), e.getClass().getName(), e.getCause());
  4. return builder.build();
  5. } catch (RemoteException e) {

代码示例来源:origin: org.opennms/opennms-vmware

  1. vmwareViJavaAccess.connect();
  2. } catch (MalformedURLException e) {
  3. logger.warn("Error connecting VMware management server '{}': '{}' exception: {} cause: '{}'", vmwareManagementServer, e.getMessage(), e.getClass().getName(), e.getCause());
  4. return builder.build();
  5. } catch (RemoteException e) {

相关文章