當前位置: 首頁>>代碼示例>>Java>>正文


Java URISyntaxException.getMessage方法代碼示例

本文整理匯總了Java中java.net.URISyntaxException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java URISyntaxException.getMessage方法的具體用法?Java URISyntaxException.getMessage怎麽用?Java URISyntaxException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.URISyntaxException的用法示例。


在下文中一共展示了URISyntaxException.getMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DOMRetrievalMethod

import java.net.URISyntaxException; //導入方法依賴的package包/類
/**
 * Creates a <code>DOMRetrievalMethod</code> containing the specified
 * URIReference and List of Transforms.
 *
 * @param uri the URI
 * @param type the type
 * @param transforms a list of {@link Transform}s. The list is defensively
 *    copied to prevent subsequent modification. May be <code>null</code>
 *    or empty.
 * @throws IllegalArgumentException if the format of <code>uri</code> is
 *    invalid, as specified by Reference's URI attribute in the W3C
 *    specification for XML-Signature Syntax and Processing
 * @throws NullPointerException if <code>uriReference</code>
 *    is <code>null</code>
 * @throws ClassCastException if <code>transforms</code> contains any
 *    entries that are not of type {@link Transform}
 */
public DOMRetrievalMethod(String uri, String type,
                          List<? extends Transform> transforms)
{
    if (uri == null) {
        throw new NullPointerException("uri cannot be null");
    }
    List<Transform> tempList =
        Collections.checkedList(new ArrayList<Transform>(),
                                Transform.class);
    if (transforms != null) {
        tempList.addAll(transforms);
    }
    this.transforms = Collections.unmodifiableList(tempList);
    this.uri = uri;
    if (!uri.equals("")) {
        try {
            new URI(uri);
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }

    this.type = type;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:DOMRetrievalMethod.java

示例2: createTreeRequest

import java.net.URISyntaxException; //導入方法依賴的package包/類
private HttpRequestBase createTreeRequest(Long parentId) {
    try {
        URIBuilder builder = new URIBuilder(serverParameters.getServerUrl()
                + serverParameters.getProjectTreeUrl());
        builder.addParameter("parentId", String.valueOf(parentId));

        HttpGet get = new HttpGet(builder.build());
        setDefaultHeader(get);
        if (isSecure()) {
            addAuthorizationToRequest(get);
        }
        return get;
    } catch (URISyntaxException e) {
        throw new ApplicationException(e.getMessage(), e);
    }
}
 
開發者ID:react-dev26,項目名稱:NGB-master,代碼行數:17,代碼來源:DatasetListHandler.java

示例3: runCommand

import java.net.URISyntaxException; //導入方法依賴的package包/類
@Override
public int runCommand() {
    try {
        String url = serverParameters.getServerUrl() + getRequestUrl();
        URIBuilder builder = new URIBuilder(String.format(url, datasetId));
        if (parentId != null) {
            builder.addParameter("parentId", String.valueOf(parentId));
        }
        HttpPut put = new HttpPut(builder.build());
        setDefaultHeader(put);
        if (isSecure()) {
            addAuthorizationToRequest(put);
        }
        RequestManager.executeRequest(put);
    } catch (URISyntaxException e) {
        throw new ApplicationException(e.getMessage(), e);
    }
    return 0;
}
 
開發者ID:react-dev26,項目名稱:NGB-master,代碼行數:20,代碼來源:DatasetMovingHandler.java

示例4: uriToPath

import java.net.URISyntaxException; //導入方法依賴的package包/類
protected Path uriToPath(URI uri) {
    String scheme = uri.getScheme();
    if ((scheme == null) || !scheme.equalsIgnoreCase(getScheme())) {
        throw new IllegalArgumentException("URI scheme is not '" + getScheme() + "'");
    }
    try {
        // only support legacy JAR URL syntax  jar:{uri}!/{entry} for now
        String spec = uri.getRawSchemeSpecificPart();
        int sep = spec.indexOf("!/");
        if (sep != -1)
            spec = spec.substring(0, sep);
        return Paths.get(new URI(spec)).toAbsolutePath();
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:ZipFileSystemProvider.java

示例5: HttpEngine

import java.net.URISyntaxException; //導入方法依賴的package包/類
/**
 * @param requestHeaders the client's supplied request headers. This class
 *     creates a private copy that it can mutate.
 * @param connection the connection used for an intermediate response
 *     immediately prior to this request/response pair, such as a same-host
 *     redirect. This engine assumes ownership of the connection and must
 *     release it when it is unneeded.
 */
public HttpEngine(OkHttpClient client, Policy policy, String method, RawHeaders requestHeaders,
    Connection connection, RetryableOutputStream requestBodyOut) throws IOException {
  this.client = client;
  this.policy = policy;
  this.method = method;
  this.connection = connection;
  this.requestBodyOut = requestBodyOut;

  try {
    uri = Platform.get().toUriLenient(policy.getURL());
  } catch (URISyntaxException e) {
    throw new IOException(e.getMessage());
  }

  this.requestHeaders = new RequestHeaders(uri, new RawHeaders(requestHeaders));
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:25,代碼來源:HttpEngine.java

示例6: buildUri

import java.net.URISyntaxException; //導入方法依賴的package包/類
static URI buildUri(String path, Map<String, String> params) {
    Objects.requireNonNull(path, "path must not be null");
    try {
        URIBuilder uriBuilder = new URIBuilder(path);
        for (Map.Entry<String, String> param : params.entrySet()) {
            uriBuilder.addParameter(param.getKey(), param.getValue());
        }
        return uriBuilder.build();
    } catch(URISyntaxException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
 
開發者ID:chaokunyang,項目名稱:jkes,代碼行數:13,代碼來源:HttpClient.java

示例7: regularUpload

import java.net.URISyntaxException; //導入方法依賴的package包/類
private boolean regularUpload(CloudBlobContainer container, String fileName, PluggableMessage pluggableMessage,
		Map<String, String> customMetadata, long fileSize) throws UnableToProduceException {
	boolean status = false;
	CloudBlockBlob singleBlob;
	String containerName = container.getName();
	try {

		if (container.exists()) {
			log.info(LOGGER_KEY + "Container exists: " + containerName);
			singleBlob = container.getBlockBlobReference(fileName);

			log.info(LOGGER_KEY + "User metadata being applied ..." + customMetadata.size() + " key(s)");
			singleBlob.setMetadata((HashMap<String, String>) customMetadata);
			log.info(LOGGER_KEY + "Initiating blob upload with regular mode");

			singleBlob.upload(FileUtils.openInputStream(pluggableMessage.getData().toFile()), fileSize);
			if (singleBlob.exists())
				log.info(LOGGER_KEY + "Azure Blob upload finished successfully.");
		}
	} catch (URISyntaxException urie) {
		log.error(LOGGER_KEY + "Azure Resource URI constructed based on the containerName is invalid. "
				+ urie.getMessage());
		throw new UnableToProduceException(urie.getMessage(), urie);
	} catch (StorageException se) {
		log.error(LOGGER_KEY + "Azure Storage Service Error occurred. " + se.getMessage());
		throw new UnableToProduceException(se.getMessage(), se);
	} catch (IOException ioe) {
		log.error(LOGGER_KEY + "Azure Storage I/O exception occurred. " + ioe.getMessage());
		throw new UnableToProduceException(ioe.getMessage(), ioe);
	} finally {
		status = true;
	}
	return status;
}
 
開發者ID:cmanda,項目名稱:axway-b2b-plugins,代碼行數:35,代碼來源:AzureBlobPluggableTransport.java

示例8: createUri

import java.net.URISyntaxException; //導入方法依賴的package包/類
private URI createUri(String uriTemplate, UriComponentsBuilder builder, UriComponents uriComponents) {
  String strUri = uriComponents.toUriString();

  if (isCrossApp(uriTemplate, builder)) {
    int idx = strUri.indexOf('/', RestConst.URI_PREFIX.length());
    strUri = strUri.substring(0, idx) + ":" + strUri.substring(idx + 1);
  }

  try {
    // Avoid further encoding (in the case of strictEncoding=true)
    return new URI(strUri);
  } catch (URISyntaxException ex) {
    throw new IllegalStateException("Could not create URI object: " + ex.getMessage(), ex);
  }
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:16,代碼來源:CseUriTemplateHandler.java

示例9: validateBeforeNext

import java.net.URISyntaxException; //導入方法依賴的package包/類
protected void validateBeforeNext() throws WizardValidationException {
    try {
        HgURL url;
        try {
            url = repository.getUrl();
        } catch (URISyntaxException ex) {
            throw new WizardValidationException((JComponent) component,
                                                ex.getMessage(),
                                                ex.getLocalizedMessage());
        }

        if (support == null) {
            support = new RepositoryStepProgressSupport();
            component.add(support.getProgressComponent(), BorderLayout.SOUTH);
        }
        support.setRepositoryRoot(url);
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(url);
        RequestProcessor.Task task = support.start(rp, url, NbBundle.getMessage(CloneRepositoryWizardPanel.class, "BK2012"));
        task.waitFinished();
    } finally {
        if (support != null) {      //see bug #167172
            /*
             * We cannot reuse the progress component because
             * org.netbeans.api.progress.ProgressHandle cannot be reused.
             */
            component.remove(support.getProgressComponent());
            support = null;
        }
    }

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:CloneRepositoryWizardPanel.java

示例10: withServiceEndpoint

import java.net.URISyntaxException; //導入方法依賴的package包/類
public Builder withServiceEndpoint(String serviceEndpoint) {
    try {
        this.serviceEndpoint = new URI(serviceEndpoint);
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
    return this;
}
 
開發者ID:Azure,項目名稱:azure-documentdb-rxjava,代碼行數:9,代碼來源:AsyncDocumentClient.java

示例11: createSession

import java.net.URISyntaxException; //導入方法依賴的package包/類
public void createSession(String alias, String url, Map<String, String> headers, Authentication auth, String verify,
		Boolean debug, String loggerClass, String password, boolean verifyHost, boolean selfSigned, Proxy proxy) {

	HostnameVerifier defaultHostnameVerifier = verifyHost ? null : NoopHostnameVerifier.INSTANCE;
	TrustStrategy trustStrategy = selfSigned ? new TrustSelfSignedStrategy() : null;

	if (!loggerClass.isEmpty()) {
		System.setProperty("org.apache.commons.logging.Log", loggerClass);
		System.setProperty("org.apache.commons.logging.robotlogger.log.org.apache.http", debug ? "DEBUG" : "INFO");
	}
	HttpHost target;
	try {
		target = URIUtils.extractHost(new URI(url));
	} catch (URISyntaxException e) {
		throw new RuntimeException("Parsing of URL failed. Error message: " + e.getMessage());
	}
	Session session = new Session();
	session.setProxy(proxy);
	session.setContext(this.createContext(auth, target));
	session.setClient(this.createHttpClient(auth, verify, target, false, password, null, null, proxy));
	session.setUrl(url);
	session.setHeaders(headers);
	session.setHttpHost(target);
	session.setVerify(verify);
	session.setAuthentication(auth);
	session.setPassword(password);
	session.setHostnameVerifier(defaultHostnameVerifier);
	session.setTrustStrategy(trustStrategy);
	sessions.put(alias, session);
}
 
開發者ID:Hi-Fi,項目名稱:httpclient,代碼行數:31,代碼來源:RestClient.java

示例12: RemoteServiceProvider

import java.net.URISyntaxException; //導入方法依賴的package包/類
private RemoteServiceProvider(String identifier, String uri) {
    this.identifier = identifier;
    try {
        server = new HproseTcpServer(uri);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        throw new RuntimeException(e.getMessage());
    }
    server.add("getIdentifier", this);
    server.add("shutdownProvider", this);
}
 
開發者ID:ZhangJiupeng,項目名稱:Gospy,代碼行數:12,代碼來源:RemoteServiceProvider.java

示例13: doHttpGet

import java.net.URISyntaxException; //導入方法依賴的package包/類
private <T extends Response> T doHttpGet(URIBuilder builder, Class<T> clazz, List<Header> header) throws BitbankException, IOException {
    try {
        URI uri = builder.build();
        HttpGet httpGet = new HttpGet(uri);
        HttpClient client = HttpClientBuilder.create().setDefaultHeaders(header).build();
        return httpExecute(client, httpGet, clazz);
    } catch (URISyntaxException e) {
        throw new BitbankException(e.getMessage());
    }
}
 
開發者ID:bitbankinc,項目名稱:java-bitbankcc,代碼行數:11,代碼來源:Bitbankcc.java

示例14: anchor

import java.net.URISyntaxException; //導入方法依賴的package包/類
BaseComponent anchor(Element el) {
    final Optional<String> href = XML.attrValue(el, "href");
    final Optional<BaseComponent> content = nonEmptyContent(el);
    final String type = XML.attrValue(el, "type").orElse("url");
    final Renderable<URI> uri;

    try {
        switch(type) {
            case "user":
                uri = new UserURI(href.orElse(""));
                break;

            case "home":
                uri = Renderable.of(Links.homeUri(href.orElse("/")));
                break;

            case "url":
                uri = Renderable.of(new URI(href.orElseThrow(() -> new MissingException("attribute", "href"))));
                break;

            default:
                throw new ValueException("Unknown anchor type '" + type + "'");
        }
    } catch(URISyntaxException e) {
        throw new ValueException(e.getMessage());
    }

    return new LinkComponent(uri, content);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:30,代碼來源:MarkupParser.java

示例15: getURI

import java.net.URISyntaxException; //導入方法依賴的package包/類
@Override
public URI getURI() {
	try {
		return this.connection.getURL().toURI();
	}
	catch (URISyntaxException ex) {
		throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:SimpleBufferingClientHttpRequest.java


注:本文中的java.net.URISyntaxException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。