下面列出了java.net.MalformedURLException#getMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public GetInsurabilityAsFlatResponse getInsurabilityAsFlat(SAMLToken token, GetInsurabilityAsXmlOrFlatRequestType request) throws GenInsBusinessConnectorException, TechnicalConnectorException, SessionManagementException {
GetInsurabilityAsFlatResponse response = null;
GetInsurabilityAsFlatRequest genericReq = new GetInsurabilityAsFlatRequest();
this.dozer(request, genericReq);
try {
GenericRequest service = ServiceFactory.getGeninsPort(token);
service.setPayload((Object)genericReq);
GenericResponse xmlResponse = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(service);
response = (GetInsurabilityAsFlatResponse)xmlResponse.asObject(GetInsurabilityAsFlatResponse.class);
return response;
} catch (MalformedURLException var7) {
LOG.error("GeninsServiceImpl : " + var7.getMessage());
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.MALFORMED_URL, var7, new Object[]{"genins " + var7.getMessage()});
} catch (SOAPException var8) {
LOG.error("GeninsServiceImpl : " + var8.getMessage());
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var8, new Object[]{var8.getMessage()});
}
}
private static Context urlToContext(String url, Hashtable<?,?> env)
throws NamingException {
DnsUrl[] urls;
try {
urls = DnsUrl.fromList(url);
} catch (MalformedURLException e) {
throw new ConfigurationException(e.getMessage());
}
if (urls.length == 0) {
throw new ConfigurationException(
"Invalid DNS pseudo-URL(s): " + url);
}
String domain = urls[0].getDomain();
// If multiple urls, all must have the same domain.
for (int i = 1; i < urls.length; i++) {
if (!domain.equalsIgnoreCase(urls[i].getDomain())) {
throw new ConfigurationException(
"Conflicting domains: " + url);
}
}
return getContext(domain, urls, env);
}
/**
* Get {@link WorkspaceProbes} for servers of the specified machines
*
* @throws InfrastructureException when the operation fails
*/
public WorkspaceProbes getProbes(
RuntimeIdentity runtimeId, Map<String, ? extends Machine> machines)
throws InfrastructureException {
List<ProbeFactory> factories = new ArrayList<>();
try {
for (Entry<String, ? extends Machine> entry : machines.entrySet()) {
fillProbes(runtimeId, entry.getKey(), factories, entry.getValue().getServers());
}
} catch (MalformedURLException e) {
throw new InternalInfrastructureException(
"Server liveness probes creation failed. Error: " + e.getMessage());
}
return new WorkspaceProbes(runtimeId.getWorkspaceId(), factories);
}
public GetTransactionListResponse getTransactionList(SAMLToken token, GetTransactionListRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
request.setRequest(RequestTypeBuilder.init().addGenericAuthor().build());
try {
GenericRequest genReq = ServiceFactory.getIntraHubPort(token, "urn:be:fgov:ehealth:interhub:protocol:v1:GetTransactionList");
genReq.setPayload((Object)request);
GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
return (GetTransactionListResponse)genResp.asObject(GetTransactionListResponse.class);
} catch (SOAPException var5) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var5, new Object[]{var5.getMessage()});
} catch (WebServiceException var6) {
throw ServiceHelper.handleWebServiceException(var6);
} catch (MalformedURLException var7) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var7, new Object[]{var7.getMessage()});
}
}
public RevokeHCPartyConsentResponse revokeHCPartyConsent(SAMLToken token, RevokeHCPartyConsentRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
request.setRequest(RequestTypeBuilder.init().addGenericAuthor().build());
try {
GenericRequest genReq = ServiceFactory.getIntraHubPort(token, "urn:be:fgov:ehealth:interhub:protocol:v1:RevokeHCPartyConsent");
genReq.setPayload((Object)request);
GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
return (RevokeHCPartyConsentResponse)genResp.asObject(RevokeHCPartyConsentResponse.class);
} catch (SOAPException var5) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var5, new Object[]{var5.getMessage()});
} catch (WebServiceException var6) {
throw ServiceHelper.handleWebServiceException(var6);
} catch (MalformedURLException var7) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var7, new Object[]{var7.getMessage()});
}
}
public PutTransactionResponse putTransaction(SAMLToken token, PutTransactionRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
if (SessionUtil.getEncryptionCrypto() == null) {
LOG.error("No Personal Crypto defined... Have you created a session that also loads your Personal eHealth Certificate?");
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.SECURITY_NO_CERTIFICATE, new Object[]{"Encryption for PutTransaction"});
} else {
request.setRequest(RequestTypeBuilder.init().addAuthorWithEncryptionInformation().build());
PutTransactionRequest encryptedRequest = (PutTransactionRequest)IntrahubEncryptionUtil.encryptFolder(request, "hub.id", "hub.application");
try {
GenericRequest genReq = ServiceFactory.getIntraHubPortWithFolderEncryption(token, "urn:be:fgov:ehealth:interhub:protocol:v1:PutTransaction");
genReq.setPayload((Object)encryptedRequest);
GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
return (PutTransactionResponse)genResp.asObject(PutTransactionResponse.class);
} catch (SOAPException var6) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var6, new Object[]{var6.getMessage()});
} catch (WebServiceException var7) {
throw ServiceHelper.handleWebServiceException(var7);
} catch (MalformedURLException var8) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var8, new Object[]{var8.getMessage()});
}
}
}
public PutTransactionResponse putTransaction(SAMLToken token, PutTransactionRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
if (SessionUtil.getEncryptionCrypto() == null) {
LOG.error("No Personal Crypto defined... Have you created a session that also loads your Personal eHealth Certificate?");
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.SECURITY_NO_CERTIFICATE, new Object[]{"Encryption for PutTransaction"});
} else {
request.setRequest(RequestTypeBuilder.init().addAuthorWithEncryptionInformation().build());
PutTransactionRequest encryptedRequest = (PutTransactionRequest)IntrahubEncryptionUtil.encryptFolder(request, "hub.id", "hub.application");
try {
GenericRequest genReq = ServiceFactory.getIntraHubPortWithFolderEncryption(token, "urn:be:fgov:ehealth:interhub:protocol:v1:PutTransaction");
genReq.setPayload((Object)encryptedRequest);
GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
return (PutTransactionResponse)genResp.asObject(PutTransactionResponse.class);
} catch (SOAPException var6) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var6, new Object[]{var6.getMessage()});
} catch (WebServiceException var7) {
throw ServiceHelper.handleWebServiceException(var7);
} catch (MalformedURLException var8) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var8, new Object[]{var8.getMessage()});
}
}
}
public RequestPublicationResponse requestPublication(SAMLToken token, RequestPublicationRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
request.setRequest(RequestTypeBuilder.init().addGenericAuthor().build());
try {
GenericRequest genReq = ServiceFactory.getIntraHubPort(token, "urn:be:fgov:ehealth:interhub:protocol:v1:RequestPublication");
genReq.setPayload((Object)request);
GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
return (RequestPublicationResponse)genResp.asObject(RequestPublicationResponse.class);
} catch (SOAPException var5) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var5, new Object[]{var5.getMessage()});
} catch (WebServiceException var6) {
throw this.handleWebServiceException(var6);
} catch (MalformedURLException var7) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var7, new Object[]{var7.getMessage()});
}
}
private static Context urlToContext(String url, Hashtable<?,?> env)
throws NamingException {
DnsUrl[] urls;
try {
urls = DnsUrl.fromList(url);
} catch (MalformedURLException e) {
throw new ConfigurationException(e.getMessage());
}
if (urls.length == 0) {
throw new ConfigurationException(
"Invalid DNS pseudo-URL(s): " + url);
}
String domain = urls[0].getDomain();
// If multiple urls, all must have the same domain.
for (int i = 1; i < urls.length; i++) {
if (!domain.equalsIgnoreCase(urls[i].getDomain())) {
throw new ConfigurationException(
"Conflicting domains: " + url);
}
}
return getContext(domain, urls, env);
}
public GetTransactionResponse getTransaction(SAMLToken token, GetTransactionRequest request) throws IntraHubBusinessConnectorException, TechnicalConnectorException {
if (SessionUtil.getEncryptionCrypto() == null) {
LOG.error("No Personal Crypto defined... Have you created a session that also loads your Personal eHealth Certificate?");
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.SECURITY_NO_CERTIFICATE, new Object[]{"Decryption for GetTransaction"});
} else {
LOG.debug("adding request with encryption id codes");
request.setRequest(RequestTypeBuilder.init().addAuthorWithEncryptionInformation().build());
GetTransactionRequest encryptedRequest = (GetTransactionRequest)IntrahubEncryptionUtil.encryptFolder(request, "hub.id", "hub.application");
LOG.debug("Sending message with KMEHR headers to hub");
try {
GenericRequest genReq = ServiceFactory.getIntraHubPortWithFolderEncryption(token, "urn:be:fgov:ehealth:interhub:protocol:v1:GetTransaction");
genReq.setPayload((Object)encryptedRequest);
GenericResponse genResp = be.ehealth.technicalconnector.ws.ServiceFactory.getGenericWsSender().send(genReq);
return (GetTransactionResponse)genResp.asObject(GetTransactionResponse.class);
} catch (SOAPException var6) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var6, new Object[]{var6.getMessage()});
} catch (WebServiceException var7) {
throw ServiceHelper.handleWebServiceException(var7);
} catch (MalformedURLException var8) {
throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_WS, var8, new Object[]{var8.getMessage()});
}
}
}
public String getName() throws IOException {
if (isFile()) return getFSFile().getName();
if (isSMB()) try {
return getSmbFile().getName();
} catch (final MalformedURLException e) {
throw new IOException("SMB.getName MalformedURLException (" + e.getMessage() + ") for " + toNormalform(false) );
}
if (isFTP()) {
return this.getFileName();
}
return null;
}
private static URL parseUrl(ConfigurationSection section, String path, @Nullable String value, URL def) {
try {
return value == null ? def : new URL(value);
} catch(MalformedURLException e) {
throw new InvalidConfigurationException(section, path, e.getMessage());
}
}
@Override
public ResourceNode getNodeById(String nodeId) throws MonitorException {
try {
return this.nodeFromMap(this.locateNode(nodeId));
} catch (MalformedURLException e) {
LOG.log(Level.SEVERE, e.getMessage());
throw new MonitorException(e.getMessage());
}
}
public FetchedResult get(String url, Payload payload) throws BaseFetchException {
try {
URL realUrl = new URL(url);
String protocol = realUrl.getProtocol();
if (!protocol.equals("http") && !protocol.equals("https")) {
throw new BadProtocolFetchException(url);
}
} catch (MalformedURLException e) {
throw new UrlFetchException(url, e.getMessage());
}
return request(url, payload);
}
@Override
public FetchedResult get(String url, Payload payload) throws BaseFetchException {
try {
URL realUrl = new URL(url);
String protocol = realUrl.getProtocol();
if (!protocol.equals("http") && !protocol.equals("https")) {
throw new BadProtocolFetchException(url);
}
} catch (MalformedURLException e) {
throw new UrlFetchException(url, e.getMessage());
}
return request(new HttpGet(), url, payload);
}
/**
* Get {@link WorkspaceProbes} for servers of a machine from a workspace runtime
*
* @throws InfrastructureException when the operation fails
*/
public WorkspaceProbes getProbes(
RuntimeIdentity runtimeId, String machineName, Map<String, ? extends Server> servers)
throws InfrastructureException {
List<ProbeFactory> factories = new ArrayList<>();
try {
fillProbes(runtimeId, machineName, factories, servers);
} catch (MalformedURLException e) {
throw new InternalInfrastructureException(
"Server liveness probes creation failed. Error: " + e.getMessage());
}
return new WorkspaceProbes(runtimeId.getWorkspaceId(), factories);
}
public java.net.URL toJavaURL() {
try {
return new java.net.URL(toString());
} catch (MalformedURLException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
public void onMalformedURLException(MalformedURLException malformedURLException) {
Message obtainMessage = this.mHandler.obtainMessage();
obtainMessage.obj = malformedURLException.getMessage();
obtainMessage.what = -3;
this.mHandler.sendMessage(obtainMessage);
}
private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gf = inputStream.readFields();
String h = (String)gf.get("host", null);
int p = (int)gf.get("port", -1);
String proto = (String)gf.get("protocol", null);
String url = (String)gf.get("urlPath", null);
if (proto == null || url == null || h == null) {
StringBuilder sb = new StringBuilder(INVALID_INSTANCE_MSG).append('[');
boolean empty = true;
if (proto == null) {
sb.append("protocol=null");
empty = false;
}
if (h == null) {
sb.append(empty ? "" : ",").append("host=null");
empty = false;
}
if (url == null) {
sb.append(empty ? "" : ",").append("urlPath=null");
}
sb.append(']');
throw new InvalidObjectException(sb.toString());
}
if (h.contains("[") || h.contains("]")) {
throw new InvalidObjectException("Invalid host name: " + h);
}
try {
validate(proto, h, p, url);
this.protocol = proto;
this.host = h;
this.port = p;
this.urlPath = url;
} catch (MalformedURLException e) {
throw new InvalidObjectException(INVALID_INSTANCE_MSG + ": " +
e.getMessage());
}
}
/**
* Returns the URL location value of specified XML attribute
*
* @param key
* name of the attribute
* @return The qualified name value
* @throws AttributeNotFoundException
* if attribute does not exist or if can not resolve reference to global parameter/property included in
* atribute's textual/string value
*/
public URL getURL(String key) throws AttributeNotFoundException {
try {
return new URL(getString(key));
} catch (MalformedURLException urle) {
throw new AttributeNotFoundException(key, urle.getMessage());
}
}