List of usage examples for java.net URISyntaxException printStackTrace
public void printStackTrace()
From source file:de.unisb.cs.st.javalanche.rhino.RhinoTestRunnable.java
public static String getCommand(String[] args) { StringBuilder sb = new StringBuilder(); sb.append("java -cp "); String main = "org/mozilla/javascript/tools/shell/Main.class"; URL resource = ClassLoader.getSystemResource(main); if (resource != null) { String location = resource.toString().substring(0, resource.toString().length() - main.length()); logger.info(location);// w ww. j a va 2s . co m File f; try { f = new File(new URI(location)); sb.append(f.toString()); } catch (URISyntaxException e) { e.printStackTrace(); } } // sb // .append(":/scratch/schuler/subjects/ibugs_rhino-0.1/jars/xmlbeans-2.2.0/lib/jsr173_1.0_api.jar:/scratch/schuler/subjects/ibugs_rhino-0.1/jars/xmlbeans-2.2.0/lib/xbean.jar"); sb.append(":" + System.getProperty("java.class.path")); sb.append(" org.mozilla.javascript.tools.shell.Main "); for (String arg : args) { sb.append(arg + " "); } String message = sb.toString(); return message; }
From source file:org.mule.module.pubsubhubbub.Utils.java
public static List<URI> getMandatoryUrlParameters(final String name, final Map<String, List<String>> parameters) { final List<String> values = parameters.get(name); if ((values == null) || (values.isEmpty())) { throw new IllegalArgumentException("Missing mandatory parameter: " + name); }// w ww . java2 s. c o m try { final List<URI> uris = new ArrayList<URI>(); for (final String value : values) { if (StringUtils.isBlank(value)) { continue; } final URI uri = new URI(value); if (StringUtils.isNotEmpty(uri.getFragment())) { throw new IllegalArgumentException("Fragment found in URL parameter: " + name); } uris.add(uri); } if (uris.isEmpty()) { throw new IllegalArgumentException("No value found for: " + name); } return uris; } catch (final URISyntaxException use) { use.printStackTrace(); throw new IllegalArgumentException("Invalid URL parameter: " + name, use); } }
From source file:org.javaweb.utils.ClassUtils.java
/** * ??jarclass//from ww w .j av a 2s . c om * * @return classList ???? * @throws IOException */ public static Set<String> getAllClass() throws IOException { Set<String> classList = new LinkedHashSet<String>(); ClassUtils classUtils = new ClassUtils(); URL url = classUtils.getClass().getProtectionDomain().getCodeSource().getLocation(); try { if (!"http".equalsIgnoreCase(url.toURI().getScheme()) && new File(url.toURI()).isDirectory()) { File f = new File(url.toURI()); findAllClassFile(f, f.toString(), classList); } else { getAllJarClass(url, classList); } } catch (URISyntaxException e) { e.printStackTrace(); } catch (IOException e) { throw e; } return classList; }
From source file:edu.wright.daselab.linkgen.ConfigurationParams.java
private static String getAndLoadLogger(String configkey) { String FILE_LOG4J_PROPERTIES = (String) config.getString(configkey); if ((null != FILE_LOG4J_PROPERTIES) && (!FILE_LOG4J_PROPERTIES.trim().equals(""))) { PropertyConfigurator.configure(FILE_LOG4J_PROPERTIES); return FILE_LOG4J_PROPERTIES; }/*from w w w . ja v a 2s . c om*/ logger.error("Config File Property Read Error for key:" + configkey); FILE_LOG4J_PROPERTIES = DEFAULT_FILE_LOG4J_PROPERTIES; File base; try { base = new File(ConfigurationParams.class.getProtectionDomain().getCodeSource().getLocation().toURI()) .getParentFile(); File loggerFile = new File(base, FILE_LOG4J_PROPERTIES); System.err.println("Using default " + loggerFile); PropertyConfigurator.configure(loggerFile.getAbsolutePath()); } catch (URISyntaxException e) { e.printStackTrace(); System.exit(1); } return FILE_LOG4J_PROPERTIES; }
From source file:com.jilk.ros.rosbridge.implementation.ROSBridgeWebSocketClient.java
public static ROSBridgeWebSocketClient create(String URIString) { ROSBridgeWebSocketClient client = null; try {//from w ww . j a v a 2 s . c om URI uri = new URI(URIString); client = new ROSBridgeWebSocketClient(uri); } catch (URISyntaxException ex) { ex.printStackTrace(); } return client; }
From source file:com.shafiq.mytwittle.urlservice.tweetmarker.TweetMarkerAPI.java
public static HttpResponse getRequest(String url, String debugName) { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); request.addHeader("X-Auth-Service-Provider", TwitterApi.TWITTER_VERIFY_CREDENTIALS_JSON); request.addHeader("X-Verify-Credentials-Authorization", TwitterManager.get().generateTwitterVerifyCredentialsAuthorizationHeader()); HttpResponse response = null;/*from w w w . ja va2 s. c o m*/ try { request.setURI(new URI(url)); // Log.d("tweetlanes url fetch", url); response = client.execute(request); // Log.d(TAG, debugName + " complete"); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return response; }
From source file:com.microsoft.azuretools.adauth.ResponseUtils.java
public static AuthenticationResult parseTokenResponse(TokenResponse tokenResponse) throws IOException { AuthenticationResult result;//from w ww .j a va2s . c o m if (tokenResponse.accessToken != null) { long expiresOn = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) + tokenResponse.expiresIn; result = new AuthenticationResult(tokenResponse.tokenType, tokenResponse.accessToken, tokenResponse.refreshToken, expiresOn); result.resource = tokenResponse.resource; IdToken idToken = parseIdToken(tokenResponse.idToken); if (idToken != null) { String tenantId = idToken.tenantId; String uniqueId = null; String displayableId = null; if (!StringUtils.isNullOrWhiteSpace(idToken.objectId)) { uniqueId = idToken.objectId; } else if (!StringUtils.isNullOrWhiteSpace(idToken.subject)) { uniqueId = idToken.subject; } if (!StringUtils.isNullOrWhiteSpace(idToken.upn)) { displayableId = idToken.upn; } else if (!StringUtils.isNullOrWhiteSpace(idToken.email)) { displayableId = idToken.email; } String givenName = idToken.givenName; String familyName = idToken.familyName; String identityProvider = (idToken.identityProvider == null) ? idToken.issuer : idToken.identityProvider; long passwordExpiresOffest = 0; if (idToken.passwordExpiration > 0) { passwordExpiresOffest = System.currentTimeMillis() + idToken.passwordExpiration; } URI changePasswordUri = null; if (!StringUtils.isNullOrEmpty(idToken.passwordChangeUrl)) { try { changePasswordUri = new URI(idToken.passwordChangeUrl); } catch (URISyntaxException ex) { ex.printStackTrace(); log.log(Level.SEVERE, "parseTokenResponse@ResponseUtils", ex); throw new IOException(ex); } } result.updateTenantAndUserInfo(tenantId, tokenResponse.idToken, new UserInfo(uniqueId, displayableId, givenName, familyName, identityProvider, passwordExpiresOffest, changePasswordUri)); } } else if (tokenResponse.error != null) { String message = tokenResponse.error + tokenResponse.errorDescription; log.log(Level.SEVERE, message); throw new AuthException(tokenResponse.error, tokenResponse.errorDescription); } else { String message = AuthError.Unknown + AuthErrorMessage.Unknown; log.log(Level.SEVERE, message); throw new AuthException(AuthError.Unknown, AuthErrorMessage.Unknown); } return result; }
From source file:com.boundary.metrics.vmware.VMWareTestUtils.java
public static MeterManagerClient getMeterClient() throws Exception { MeterManagerClient client = null;/*ww w . j a v a 2 s.c o m*/ File propertiesFile = new File(Resources.getResource(DEFAULT_METER_CLIENT_CONFIGURATION).toURI()); Reader reader = new FileReader(propertiesFile); clientProperties = new Properties(); clientProperties.load(reader); String baseUri = clientProperties.getProperty(METER_CLIENT_BASE_URL); String orgId = clientProperties.getProperty(METER_CLIENT_ORG_ID); String apiKey = clientProperties.getProperty(METER_CLIENT_API_KEY); checkArgument(!Strings.isNullOrEmpty(baseUri)); checkArgument(!Strings.isNullOrEmpty(apiKey)); checkArgument(!Strings.isNullOrEmpty(orgId)); ObjectMapper mapper = new ObjectMapper(); MetricRegistry registry = new MetricRegistry(); environment = new Environment("test", mapper, null, registry, ClassLoader.getSystemClassLoader()); String configFile = "vmware-adapter-test.yml"; configuration = VMWareTestUtils.getConfiguration(configFile); Client httpClient = new JerseyClientBuilder(environment).using(configuration.getClient()) .build("http-client"); try { URI uri = new URI(baseUri); client = new MeterManagerClient(httpClient, uri, orgId, apiKey); } catch (URISyntaxException e) { e.printStackTrace(); } return client; }
From source file:com.tweetlanes.android.urlservice.tweetmarker.TweetMarkerAPI.java
public static HttpResponse getRequest(String url, String debugName) { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); request.addHeader("X-Auth-Service-Provider", TwitterApi.TWITTER_VERIFY_CREDENTIALS_JSON); request.addHeader("X-Verify-Credentials-Authorization", TwitterManager.get().generateTwitterVerifyCredentialsAuthorizationHeader()); HttpResponse response = null;/* ww w. ja va 2 s.co m*/ try { request.setURI(new URI(url)); //Log.d("tweetlanes url fetch", url); response = client.execute(request); //Log.d(TAG, debugName + " complete"); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return response; }
From source file:net.refractions.udig.document.source.ShpDocUtils.java
/** * Gets the absolute path with the url as the parent path and the relative path as the child * path./*from w ww .j av a2 s . co m*/ * * @param url * @param relativePath * @return absolute path */ public static String getAbsolutePath(URL url, String relativePath) { if (relativePath != null && relativePath.trim().length() > 0) { try { final File parentFile = new File(new URI(url.toString())); final File childFile = new File(parentFile.getParent(), relativePath); return childFile.getAbsolutePath(); } catch (URISyntaxException e) { // Should not happen as shapefile should be a valid file e.printStackTrace(); } } return null; }