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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations