private URI createKeyProviderURI(Configuration conf) { final String providerUriStr = conf.getTrimmed( CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_PROVIDER_PATH); // No provider set in conf if (providerUriStr == null || providerUriStr.isEmpty()) { LOG.error("Could not find uri with key [" + CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_PROVIDER_PATH + "] to create a keyProvider !!"); return null; } final URI providerUri; try { providerUri = new URI(providerUriStr); } catch (URISyntaxException e) { LOG.error("KeyProvider URI string is invalid [" + providerUriStr + "]!!", e.getCause()); return null; } return providerUri; }
private URI createKeyProviderURI(Configuration conf) { final String providerUriStr = conf.getTrimmed(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI, ""); // No provider set in conf if (providerUriStr.isEmpty()) { LOG.error("Could not find uri with key [" + DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI + "] to create a keyProvider !!"); return null; } final URI providerUri; try { providerUri = new URI(providerUriStr); } catch (URISyntaxException e) { LOG.error("KeyProvider URI string is invalid [" + providerUriStr + "]!!", e.getCause()); return null; } return providerUri; }
@RequestMapping(method = RequestMethod.GET) public void handleFederatedRequest(HttpServletRequest request, HttpServletResponse response) { Map parameters = request.getParameterMap(); HttpGet httpGetRequest; try { httpGetRequest = new HttpGet(buildWithParameters(parameters, federatedEndpointURL).build()); } catch (URISyntaxException e) { throw new RuntimeException( String.format("There was an error creating the Http Request.\n" + "Error : %s ." , e.getCause())); } httpGetRequest.addHeader("Accept", "application/json"); sendRequest(httpGetRequest, response); }
@Override public String decide(String location) { Validate.notNull(location, "Location to decide can not be a null object."); if (!location.startsWith(scheme.toString())) { location = new StringBuilder(scheme.toString()).append(location).toString(); } try { URI uri = new URI(location); File file = new File(uri); if (!file.exists()) { throw new IllegalArgumentException(String.format("File specified by %s was not found", location)); } return fileToUrl(file).toExternalForm(); } catch (URISyntaxException ex) { throw new LocationException(String.format("Unable to convert '%s' to URI", location), ex.getCause()); } }
@Override public String decide(String location) { Validate.notNull(location, "Location to decide can not be a null object."); if (!location.startsWith(scheme.toString())) { location = new StringBuilder(scheme.toString()).append(location).toString(); } try { URI uri = new URI(location); File file = new File(uri); if (!file.exists()) { throw new IllegalArgumentException(String.format("File specified by %s was not found", location)); } return fileToUrl(file).toExternalForm(); } catch (URISyntaxException ex) { throw new LocationException(String.format("Unable to convert '%s' to URI", location), ex.getCause()); } }
@Override public String decide(String location) { Validate.notNull(location, "Location to decide can not be a null object."); if (!location.startsWith(scheme.toString())) { location = new StringBuilder(scheme.toString()).append(location).toString(); } URI uri = null; try { uri = new URI(location); } catch (URISyntaxException ex) { throw new LocationException(String.format("Unable to convert '%s' to URI", location), ex.getCause()); } String resourceName = uri.getSchemeSpecificPart(); if (resourceName.startsWith("//")) { resourceName = resourceName.substring(2); } URL url = LocationEnricher.class.getClassLoader().getResource(resourceName); if (url == null) { throw new IllegalArgumentException(String.format("Resource '%s' specified by %s was not found", resourceName, location)); } return url.toExternalForm(); }
@Override public String decide(String location) { Validate.notNull(location, "Location to decide can not be a null object."); if (!location.startsWith(scheme.toString())) { location = new StringBuilder(scheme.toString()).append(location).toString(); } URI uri = null; try { uri = new URI(location); } catch (URISyntaxException ex) { throw new LocationException(String.format("Unable to convert '%s' to URI", location), ex.getCause()); } String resourceName = uri.getSchemeSpecificPart(); if (resourceName.startsWith("//")) { resourceName = resourceName.substring(2); } URL url = LocationEnricher.class.getClassLoader().getResource(resourceName); if (url == null) { throw new IllegalArgumentException(String.format("Resource '%s' specified by %s was not found", resourceName, location)); } return url.toExternalForm(); }
@Override public void hyperlinkUpdate(HyperlinkEvent e) { if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { try { Log.error(e.getURL().toString()); Desktop.getDesktop().browse(new URI(e.getURL().toString())); } catch (IOException ex) { Log.error(ex.getCause()); } } catch (URISyntaxException ex) { Log.error(ex.getCause()); } } } });
private URI createKeyProviderURI(Configuration conf) { final String providerUriStr = conf.getTrimmed(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI, ""); // No provider set in conf if (providerUriStr.isEmpty()) { LOG.error("Could not find uri with key [" + DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI + "] to create a keyProvider !!"); return null; } final URI providerUri; try { providerUri = new URI(providerUriStr); } catch (URISyntaxException e) { LOG.error("KeyProvider URI string is invalid [" + providerUriStr + "]!!", e.getCause()); return null; } return providerUri; }
} catch (URISyntaxException ex) { logger.error("Error connecting to Couchbase: " + ex.getMessage()); DTThrowable.rethrow(ex.getCause());