List of usage examples for java.net URISyntaxException printStackTrace
public void printStackTrace()
From source file:de.hero.vertretungsplan.HtmlWork.java
public HtmlWork(Context pContext) { context = pContext;// w w w . j a v a 2 s .c om Log.d("HtmlWork", "Constructor"); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); if (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected()) { try { if (mySharedPreferences.getBoolean("prefs_debug", false)) { execute(new URI(context.getString(R.string.debug_htmlAdresse))); } else { execute(new URI(context.getString(R.string.htmlAdresse))); } } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:com.example.guan.webrtc_android_7.common.WebSocketClient.java
public void connect(final String wsUrl, final String postUrl) { checkIfCalledOnValidThread();//from w w w. ja v a2s . c o m if (state != WebSocketConnectionState.NEW) { Log.e(TAG, "WebSocket is already connected."); return; } wsServerUrl = wsUrl; postServerUrl = postUrl; closeEvent = false; Log.d(TAG, "Connecting WebSocket to: " + wsUrl + ". Post URL: " + postUrl); ws = new WebSocketConnection(); wsObserver = new WebSocketObserver(); try { ws.connect(new URI(wsServerUrl), wsObserver); Log.d(TAG, "Success to Connect WebSocket!"); } catch (URISyntaxException e) { e.printStackTrace(); reportError(roomID, "URI error: " + e.getMessage()); } catch (WebSocketException e) { e.printStackTrace(); reportError(roomID, "WebSocket connection error: " + e.getMessage()); } catch (Exception e) { e.printStackTrace(); } }
From source file:iristk.cfg.ABNFGrammar.java
private List<Object> parseMatches(String matches) throws IOException, GrammarException { //System.out.println(matches); checkBalance(matches, '{', '}'); checkBalance(matches, '(', ')'); checkBalance(matches, '[', ']'); checkBalance(matches, '<', '>'); //System.out.println("#" + matches + "#"); matches = matches.trim();/*from w w w. jav a2 s .c o m*/ List<String> groups = split(matches, "|"); if (groups.size() > 1) { OneOf oneof = new OneOf(); for (String gr : groups) { List<Object> grl = parseMatches(gr); if (grl.size() == 1) { oneof.add(grl.get(0)); } else { oneof.add(new Item(grl)); } } List<Object> result = new ArrayList<Object>(); result.add(oneof); return result; } List<Object> result = new ArrayList<Object>(); groups = split(matches, " "); if (groups.size() > 1) { for (String gr : groups) { List<Object> grl = parseMatches(gr); if (grl.size() == 1) { result.add(grl.get(0)); } else { result.add(new Item(grl)); } } } else { String group = groups.get(0); if (group.startsWith("(")) { List<Object> tag = null; if (group.endsWith("}")) { Matcher m = Pattern.compile("\\{[^\\(\\{\\}\\)]*\\}$").matcher(group); m.find(); tag = parseMatches(m.group(0)); group = m.replaceFirst("").trim(); } List<Object> list = parseMatches(group.substring(1, group.length() - 1)); if (list.size() == 1) result.add(list.get(0)); else result.add(new Item(list)); if (tag != null) result.addAll(tag); } else if (group.startsWith("$<")) { String ref = group.replace("$<", "").replace(">", "").trim(); try { ABNFGrammar include = new ABNFGrammar(uri == null ? new URI(ref) : uri.resolve(ref)); include(include); result.add(new RuleRef(include.includeRoot())); } catch (URISyntaxException e) { e.printStackTrace(); } } else if (group.startsWith("$")) { result.add(new RuleRef(group.substring(1))); } else if (group.startsWith("{")) { if (!group.endsWith("}")) throw new GrammarException("Bad expression: " + group); result.add(new Tag(group.substring(1, group.length() - 1))); } else if (group.startsWith("[")) { if (!group.endsWith("]")) throw new GrammarException("Bad expression: " + group); List<Object> list = parseMatches(group.substring(1, group.length() - 1)); Item optional = new Item(list); optional.setRepeat(0, 1); result.add(optional); } else { result.add(group); } } return result; }
From source file:org.rifidi.designer.library.basemodels.boxproducer.BoxproducerEntity.java
@Override public void loaded() { if (model == null) { URI modelpath = null;/* w w w.j a v a 2 s.c o m*/ try { modelpath = getClass().getClassLoader() .getResource("org/rifidi/designer/library/basemodels/boxproducer/blankdisc.jme") // .getResource("org/rifidi/designer/library/basemodels/boxproducer/boxproducer_saucer.jme") .toURI(); } catch (URISyntaxException e) { e.printStackTrace(); } try { model = (Node) BinaryImporter.getInstance().load(modelpath.toURL()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } thread = new BoxproducerEntityThread(this, productService, products); thread.setInterval((int) speed * 1000); thread.start(); if (running) turnOn(); }
From source file:com.almende.eve.goldemo.Cell.java
/** * @param alive//from w w w. java2s. co m * @param cycle * @param neighborNo */ public void collect(@Name("alive") boolean alive, @Name("cycle") int cycle, @Name("from") int neighborNo) { if (neighbors == null) { neighbors = getState().get("neighbors", new TypeUtil<ArrayList<String>>() { }); } CycleState state = new CycleState(cycle, alive); // System.out.println(getId()+": Received state:" + state + " from:" + // neighborNo); getState().put(neighborNo + "_" + state.getCycle(), state); try { calcCycle(true); } catch (URISyntaxException e) { e.printStackTrace(); } }
From source file:org.andrico.andrico.facebook.FBBase.java
public HttpResponse execute(FBMethod method, WriteToProgressHandler progressHandler) { method.mParameters.put("call_id", Long.toString(System.nanoTime())); try {/*from w w w. ja va 2s .c om*/ Log.d(LOG, "Executing: " + method.getRequestUrl()); if (method.hasData()) { MultipartEntity multipartEntity = makeMultipartEntityFromParameters(method, progressHandler); return mHttpClientService.execute(method.getRequestUrl(), multipartEntity); } else { return mHttpClientService.execute(method.getRequestUrl()); } } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
From source file:org.andrico.andrico.facebook.FBBase.java
/** * Add a method to the execution stack, the provided callback will be run * after having mResult set, which should be accessed with * FacebookMethodCallback.getResult(). This method will properly sequence * and add needed parameters before executing the call. * //from w w w .jav a 2 s . co m * @param method The method to run * @param runnable The callback to be run upon completion of the method. */ public void submit(FBMethod method, IHttpResponseRunnable runnable, WriteToProgressHandler progressHandler) { method.mParameters.put("call_id", Long.toString(System.nanoTime())); try { Log.d(LOG, "Executing: " + method.getRequestUrl()); if (method.hasData()) { MultipartEntity multipartEntity = makeMultipartEntityFromParameters(method, progressHandler); mHttpClientService.submit(method.getRequestUrl(), multipartEntity, runnable); } else { mHttpClientService.submit(method.getRequestUrl(), runnable); } } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:cauchy.android.tracker.PicasaWSUtils.java
public PicasaWSUtils(String user, String passwd) { userID = user;//from w ww.j a va2s . c o m String url = "https://www.google.com/accounts/ClientLogin"; DefaultHttpClient httpclient = new DefaultHttpClient(); HttpResponse response; try { HttpPost httpost = new HttpPost(new URI(url)); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("accountType", "GOOGLE")); nvps.add(new BasicNameValuePair("Email", userID)); nvps.add(new BasicNameValuePair("Passwd", passwd)); nvps.add(new BasicNameValuePair("service", "lh2")); nvps.add(new BasicNameValuePair("source", "companyName-applicationName-1.0")); httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); // Post, check and show the result (not really spectacular, but // works): response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); Log.d(LOG_TAG, "Google Login auth result = " + response.getStatusLine()); if (entity != null) { InputStream toto = entity.getContent(); long content_length = entity.getContentLength(); StringBuffer content_buf = new StringBuffer(); for (long i = 0; i < content_length; i++) { content_buf.append(((char) toto.read())); } int index = content_buf.toString().indexOf("Auth="); if (index != -1) { authString = content_buf.toString().substring(index + "Auth=".length(), content_buf.toString().length() - 1); } entity.consumeContent(); } else { Log.d(LOG_TAG, "Entity is null!"); } } catch (URISyntaxException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { httpclient.getConnectionManager().closeExpiredConnections(); } }
From source file:org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.help.HelpManager.java
public void handleHelp(String[] words) { if (words[0].equals("help")) { try {//from www . j av a2s . c o m openInBrowser(makeSearchURI(words)); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { stdout.println(giveHelp(words)); } }
From source file:com.subgraph.vega.internal.model.web.WebPath.java
private URI generateURI() { final URI hostUri = mountPoint.getWebHost().getUri(); try {//from w w w.j av a2s . com return new URI(hostUri.getScheme(), hostUri.getAuthority(), getFullPath(), null, null); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }