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

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

本文整理了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

private URL fileToUrl(File file) {
    Validate.notNull(file, "File to get URL of can not be a null object.");

    try {
      URL url = file.getAbsoluteFile().toURI().toURL();
      return url;
    } catch (MalformedURLException ex) {
      throw new IllegalArgumentException(String.format("Unable to get URL of file %s", file.getAbsolutePath()), ex.getCause());
    }

  }
}

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

private URL fileToUrl(File file) {
    Validate.notNull(file, "File to get URL of can not be a null object.");

    try {
      URL url = file.getAbsoluteFile().toURI().toURL();
      return url;
    } catch (MalformedURLException ex) {
      throw new IllegalArgumentException(String.format("Unable to get URL of file %s", file.getAbsolutePath()), ex.getCause());
    }

  }
}

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

public JMXConnector connect() throws CollectorException {
 try {
  JMXServiceURL jmxServiceURL = new JMXServiceURL(this.jmxServiceURL);
  jmxConnector = JMXConnectorFactory.connect(jmxServiceURL, jmxEnv);
 } catch (MalformedURLException e) {
  throw new CollectorException(String.format("%s occurred. URL: %s. Reason: %s",
      e.getClass().getCanonicalName(), this.jmxServiceURL, e.getCause()), e);
 } catch (IOException e) {
  throw new CollectorException(String.format("%s occurred. URL: %s. Reason: %s",
      e.getClass().getCanonicalName(), this.jmxServiceURL, e.getCause()), e);
 }
 return jmxConnector;
}

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

/**
 * Get URL
 */
public URL getURL () throws OpenAS2Exception
{
 URI uri = null;
 try
 {
  uri = m_aRequestBuilder.getUri ();
  return uri.toURL ();
 }
 catch (final MalformedURLException ex)
 {
  if (LOGGER.isErrorEnabled ())
   LOGGER.error ("Failed to get URL from connection, URI: " + uri.toASCIIString (), ex);
  throw new OpenAS2Exception (ex.getCause ());
 }
}

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

private String getURLFromLocationWithRoot(String location) {
  URL contextRoot = locationStore.get().getURL();
  if (contextRoot != null) {
    try {
      return new URL(contextRoot, location).toExternalForm();
    } catch (MalformedURLException ex) {
      throw new LocationException("URL to construct is malformed.", ex.getCause());
    }
  }
  throw new LocationException(String.format(
    "The location %s is not valid URI and no contextRoot was discovered to treat it as relative URL",
    location));
}

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

private String getURLFromLocationWithRoot(String location) {
  URL contextRoot = locationStore.get().getURL();
  if (contextRoot != null) {
    try {
      return new URL(contextRoot, location).toExternalForm();
    } catch (MalformedURLException ex) {
      throw new LocationException("URL to construct is malformed.", ex.getCause());
    }
  }
  throw new LocationException(String.format(
    "The location %s is not valid URI and no contextRoot was discovered to treat it as relative URL",
    location));
}

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

private void searchWar() {
  final String path = "/WEB-INF/jbpm4jsf-config.xml";
  final FacesContext facesContext = FacesContext.getCurrentInstance();
  final ExternalContext externalContext = facesContext.getExternalContext();
  final ServletContext servletContext = (ServletContext) externalContext.getContext();
  try {
    final URL resource = servletContext.getResource(path);
    handleConfiguration(resource);
  } catch (MalformedURLException e) {
    final FacesException ex = new FacesException("Failed to read configuration resource: " + e.getMessage(), e.getCause());
    ex.setStackTrace(e.getStackTrace());
    throw ex;
  }
}

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

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

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

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

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

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

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

public void testConnection(org.geoserver.geofence.gui.client.model.GSInstanceModel instance) throws ApplicationException {
  try {
    String response = getURL(instance.getBaseURL() + "/rest/geofence/info", instance.getUsername(), instance.getPassword());
    if(response != null) {
      if(!response.equals(instance.getName())) {
        if(response.contains("Geoserver Configuration API")) { // some heuristic here
          logger.error("GeoFence probe not installed on " + instance.getName());
          throw new ApplicationException("GeoFence probe not installed on " + instance.getName());
        } else {
          logger.error("Wrong instance name: " + response);
          throw new ApplicationException("Wrong instance name: " + instance.getName() + ", should be :" + response);
        }
      }
    } else {
      throw new ApplicationException("Error contacting GeoServer");
    }            
  } catch (MalformedURLException e) {
    logger.error(e.getLocalizedMessage(), e.getCause());
    throw new ApplicationException(e.getLocalizedMessage(),
        e.getCause());
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

相关文章