Search in sources :

Example 51 with URISyntaxException

use of java.net.URISyntaxException in project ratpack by ratpack.

the class ServerEnvironment method parseUri.

private static URI parseUri(String description, String value) {
    if (value != null) {
        try {
            URI uri = STARTS_WITH_SCHEME_PATTERN.matcher(value).matches() ? new URI(value) : new URI("http://" + value);
            String scheme = uri.getScheme();
            if (scheme.equals("http") || scheme.equals("https")) {
                return uri;
            } else {
                LOGGER.warn("Could not use {} value {} as it is not a http/https URI, ignoring value", description, value);
            }
        } catch (URISyntaxException e) {
            LOGGER.warn("Could not convert {} with value {} to a URI ({}), ignoring value", description, value, e.getMessage());
        }
    }
    return null;
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 52 with URISyntaxException

use of java.net.URISyntaxException in project databus by linkedin.

the class DbusModPartitionedFilterFactory method toLegacyUris.

private static URI[] toLegacyUris(String... srcUris) throws DatabusException {
    URI[] uris = new URI[srcUris.length];
    int i = 0;
    try {
        for (String s : srcUris) uris[i++] = new URI(s);
    } catch (URISyntaxException e) {
        throw new DatabusException(e);
    }
    return uris;
}
Also used : DatabusException(com.linkedin.databus2.core.DatabusException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 53 with URISyntaxException

use of java.net.URISyntaxException in project databus by linkedin.

the class DbusRangePartitionedFilterFactory method toLegacyUris.

private static URI[] toLegacyUris(String... srcUris) throws DatabusException {
    URI[] uris = new URI[srcUris.length];
    int i = 0;
    try {
        for (String s : srcUris) uris[i++] = new URI(s);
    } catch (URISyntaxException e) {
        throw new DatabusException(e);
    }
    return uris;
}
Also used : DatabusException(com.linkedin.databus2.core.DatabusException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 54 with URISyntaxException

use of java.net.URISyntaxException in project databus by linkedin.

the class DatabusHttpClientImpl method registerDatabusListener.

protected List<DatabusV2ConsumerRegistration> registerDatabusListener(DatabusV2ConsumerRegistration listener, Map<List<DatabusSubscription>, Set<ServerInfo>> groupsServers, Map<List<DatabusSubscription>, List<DatabusV2ConsumerRegistration>> groupsListeners, List<DatabusSubscription> sources) throws DatabusClientException {
    List<DatabusSubscription> subsSources = null;
    ServerInfo randomRelay = getRandomRelay(groupsServers, sources);
    if (null == randomRelay) {
        // even if there is no relay available to serve it immediately.
        assert getClientStaticConfig().usesDynamicRelayConfiguration() : "Client relay(s) configured statically but no relays available at listener registration";
        subsSources = sources;
    } else {
        try {
            subsSources = DatabusSubscription.createFromUriList(randomRelay.getSources());
        } catch (DatabusException e) {
            throw new DatabusClientException("source list decode error:" + e.getMessage(), e);
        } catch (URISyntaxException e) {
            throw new DatabusClientException("source list decode error:" + e.getMessage(), e);
        }
    }
    List<DatabusV2ConsumerRegistration> consumers = getListOfConsumerRegsFromSubList(groupsListeners, subsSources);
    if (null == consumers) {
        consumers = new CopyOnWriteArrayList<DatabusV2ConsumerRegistration>();
        groupsListeners.put(subsSources, consumers);
    }
    consumers.add(listener);
    return consumers;
}
Also used : DatabusV2ConsumerRegistration(com.linkedin.databus.client.consumer.DatabusV2ConsumerRegistration) DatabusException(com.linkedin.databus2.core.DatabusException) ServerInfo(com.linkedin.databus.client.pub.ServerInfo) URISyntaxException(java.net.URISyntaxException) DatabusSubscription(com.linkedin.databus.core.data_model.DatabusSubscription) DatabusClientException(com.linkedin.databus.client.pub.DatabusClientException)

Example 55 with URISyntaxException

use of java.net.URISyntaxException in project rest.li by linkedin.

the class PatchBuilder method buildPatchFromString.

@SuppressWarnings("unchecked")
public static <T extends RecordTemplate> PatchRequest<T> buildPatchFromString(String patch) {
    PatchRequest<T> patchRequest = null;
    try {
        RestRequest restRequest = new RestRequestBuilder(new URI("/test")).setEntity(patch.getBytes()).build();
        patchRequest = (PatchRequest<T>) ArgumentBuilder.extractEntity(restRequest, PatchRequest.class);
    } catch (URISyntaxException e) {
    }
    return patchRequest;
}
Also used : RestRequest(com.linkedin.r2.message.rest.RestRequest) RestRequestBuilder(com.linkedin.r2.message.rest.RestRequestBuilder) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Aggregations

URISyntaxException (java.net.URISyntaxException)1633 URI (java.net.URI)1080 IOException (java.io.IOException)451 URL (java.net.URL)287 File (java.io.File)280 ArrayList (java.util.ArrayList)146 MalformedURLException (java.net.MalformedURLException)102 InputStream (java.io.InputStream)93 HashMap (java.util.HashMap)91 Test (org.testng.annotations.Test)88 Response (javax.ws.rs.core.Response)87 Builder (javax.ws.rs.client.Invocation.Builder)84 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)84 Parameters (org.testng.annotations.Parameters)84 BaseTest (org.xdi.oxauth.BaseTest)84 ResponseType (org.xdi.oxauth.model.common.ResponseType)84 AuthorizationRequest (org.xdi.oxauth.client.AuthorizationRequest)78 Test (org.junit.Test)75 REGISTRATION_CLIENT_URI (org.xdi.oxauth.model.register.RegisterResponseParam.REGISTRATION_CLIENT_URI)72 Intent (android.content.Intent)63