List of usage examples for java.net URISyntaxException printStackTrace
public void printStackTrace()
From source file:com.brightcove.zartan.common.verifier.VideoResponse.java
public JsonNode getJsonForDelivery(VerifiableUpload upload, BasicNameValuePair delivery) { List<NameValuePair> parameters = new ArrayList<NameValuePair>(); Video v = upload.getUploadInfo().getVideo(); if (v.getVideoId() != null) { parameters.add(new BasicNameValuePair("command", "find_video_by_id")); parameters.add(new BasicNameValuePair("videoId", v.getVideoId().toString())); } else {//from www. j a va 2s .c o m parameters.add(new BasicNameValuePair("command", "find_video_by_reference_id")); parameters.add(new BasicNameValuePair("reference_id", v.getRefId())); } String readtoken = null; for (Credentials c : upload.getAccount().getCredentials()) { if (c instanceof ApiCredentials) { readtoken = ((ApiCredentials) c).getReadToken(); } } // TODO: throw if token is null parameters.add(new BasicNameValuePair("token", readtoken)); parameters.add(delivery); parameters.add(new BasicNameValuePair("fields", "thumbnailURL,videoStillURL," + "shortDescription,tags,customFields,id,length," + "creationDate,publishedDate,startDate,endDate,linkURL,referenceId," + "linkText,videoFullLength,longDescription,accountId," + "itemState,lastModifiedDate,economics,adKeys,geoRestricted," + "geoFilteredCountries,geoFilterExclude,cuePoints,playsTotal," + "playsTrailingWeek,FLVURL,renditions,iosrenditions,name")); JsonNode result = null; try { result = (new MediaAPIHelper()).executeRead(upload.getEnvironment(), parameters); } catch (URISyntaxException uriSyntaxException) { uriSyntaxException.printStackTrace(); } catch (MediaAPIException e) { e.printStackTrace(); } return result; }
From source file:com.example.memorycalendar3.LED_Setting_Dialog.java
public void connectWebSocket() throws JSONException { URI uri;//ww w .j a v a 2s . com final String uemail = SplashActivity.getEmail(); final JSONObject Event_Obj = new JSONObject();//event final JSONObject Sync_Obj = new JSONObject(); Map<String, ?> MapObject = data.getAll(); //map sharedpreference key-value .(sharedpreferenced event .) for (Map.Entry<String, ?> entry : MapObject.entrySet()) { Event_Obj.put(entry.getKey(), entry.getValue().toString()); } Sync_Obj.put("Event_Classify", Event_Obj.toString()); //. try { uri = new URI("ws://175.126.125.198:8081/App"); } catch (URISyntaxException e) { e.printStackTrace(); return; } mWebSocketClient = new WebSocketClient(uri, uemail) { @Override public void onOpen(ServerHandshake serverHandshake) { Log.i("Websocket", "Opened"); mWebSocketClient.send("Sync_Event_Classify#" + Sync_Obj.toString()); } @Override public void onMessage(String s) { final String message = s; runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub } }); } private void runOnUiThread(Runnable runnable) { // TODO Auto-generated method stub } @Override public void onClose(int i, String s, boolean b) { Log.i("Websocket", "Closed " + s); } @Override public void onError(Exception e) { Log.i("Websocket", "Error " + e.getMessage()); } }; mWebSocketClient.connect(); }
From source file:org.apache.archiva.repository.features.IndexCreationFeature.java
public IndexCreationFeature(Repository repoId, RepositoryEventListener listener) { super(listener); this.repo = repoId; try {/*from w ww . j a va 2s.c o m*/ this.indexPath = new URI(DEFAULT_INDEX_PATH); this.packedIndexPath = new URI(DEFAULT_PACKED_INDEX_PATH); } catch (URISyntaxException e) { // Does not happen e.printStackTrace(); } }
From source file:com.flicklib.service.HttpClientSourceLoader.java
private Source buildSource(String url, HttpResponse response, HttpRequestBase httpMethod, HttpContext ctx) throws IOException { LOGGER.info("Finished loading at " + httpMethod.getURI().toString()); final HttpEntity entity = response.getEntity(); String responseCharset = EntityUtils.getContentCharSet(entity); String contentType = EntityUtils.getContentMimeType(entity); LOGGER.info("Response charset = " + responseCharset); String content = EntityUtils.toString(entity); HttpUriRequest req = (HttpUriRequest) ctx.getAttribute(ExecutionContext.HTTP_REQUEST); HttpHost target = (HttpHost) ctx.getAttribute(ExecutionContext.HTTP_TARGET_HOST); URI resultUri;/*from w w w . ja v a 2 s .c o m*/ try { resultUri = (target != null && req != null) ? new URI(target.toURI() + req.getURI().toString()) : httpMethod.getURI(); } catch (URISyntaxException e) { e.printStackTrace(); resultUri = httpMethod.getURI(); } // String contentType = URLConnection.guessContentTypeFromName(url) return new Source(resultUri.toString(), content, contentType, url); }
From source file:vn.chodientu.component.imboclient.Url.ImboUrl.java
/** * Returns the URL in URI format// w w w .j a v a 2s .c om * * @return Full URL with query parameters, as a URI */ public URI toUri() { try { return new URI(getUrl()); } catch (URISyntaxException e) { e.printStackTrace(); return null; } }
From source file:org.archive.wayback.util.htmllex.ParseContext.java
/** * @param url which should be resolved./*w ww . j a v a 2s. co m*/ * @return absolute form of input url, or url itself if javascript: */ public String contextualizeUrl(String url) { if (url.startsWith("javascript:") || url.startsWith("#")) { return url; } try { return resolve(url); } catch (URISyntaxException e) { e.printStackTrace(); return url; } }
From source file:eu.planets_project.tb.api.data.util.DigitalObjectRefBean.java
private URI createDownloadUri(String id, String prefix) { // Define the download URI: log.debug("Creating the download URL."); String context = "/testbed"; if (FacesContext.getCurrentInstance() != null) { HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() .getRequest();//from ww w. j a v a 2s . co m context = req.getContextPath(); } URI download = null; try { download = new URI("https", PlanetsServerConfig.getHostname() + ":" + PlanetsServerConfig.getSSLPort(), context + prefix, "fid=" + URLEncoder.encode(id, "UTF-8"), null); /* This can be used if the above is causing problems download = new URI( null, null, context+"/reader/download.jsp","fid="+id, null); */ } catch (URISyntaxException e) { e.printStackTrace(); download = null; } catch (UnsupportedEncodingException e) { e.printStackTrace(); download = null; } log.debug("Created download URI: " + download); return download; }
From source file:com.trigger_context.conf.Set_File_Select.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case FILE_SELECT_CODE: if (resultCode == RESULT_OK) { // Get the Uri of the selected file Uri uri = data.getData();//from w w w . ja v a 2s . co m // Get the path try { path = getPath(this, uri); EditText et = (EditText) findViewById(R.id.editText1); et.setText(path); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Get the file instance // File file = new File(path); // Initiate the upload } break; } }
From source file:appathon.history.PickerActivity.java
private void finishActivity() { HashMap<String, URI> facebook_friends_username_imageuri = new HashMap<String, URI>(); List<GraphUser> selectedUsers = friendPickerFragment.getSelection(); for (GraphUser graphUser : selectedUsers) { JSONObject jsonUser = graphUser.getInnerJSONObject(); URI user_avatar_uri = null; try {/* ww w . j a v a2 s. c o m*/ user_avatar_uri = new URI(jsonUser.getJSONObject("picture").getJSONObject("data").getString("url")); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } facebook_friends_username_imageuri.put(graphUser.getName(), user_avatar_uri); } Intent intent = new Intent(this, MainActivity.class); intent.putExtra("facebook_friends_username_imageuri", facebook_friends_username_imageuri); startActivity(intent); finish(); }
From source file:strat.mining.stratum.proxy.configuration.ConfigurationManager.java
/** * Return the jar file.//from ww w . ja v a 2 s .c o m * * @return */ private static File getJarFile() { Path absolutePath = null; try { absolutePath = Paths .get(ConfigurationManager.class.getProtectionDomain().getCodeSource().getLocation().toURI()); } catch (URISyntaxException e) { String errorMessage = "Failed to get the installation directory."; if (logger != null) { logger.error(errorMessage, e); } else { System.err.println(e); e.printStackTrace(); } } return absolutePath.toFile(); }