List of usage examples for java.io UnsupportedEncodingException printStackTrace
public void printStackTrace()
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrCheckAggregator() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { CheckAggregator checkAggregator = CheckAggregator.newBuilder().setAgentType(Constants.AGENT_TYPE) .build();//from w ww . j ava 2 s . c om try { boolean bool = AggregatorRetrieve.checkAggregatorStatus(checkAggregator); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm CheckAggregator"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrSendServiceSuggestion() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { ServiceSuggestion serviceSuggestion = ServiceSuggestion.newBuilder().setHostName("name").setIp("ip") .setServiceName("name").build(); try { boolean bool = AggregatorRetrieve.sendServiceSuggestion(serviceSuggestion); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();//from w ww . j a v a2 s . co m } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm SendServiceSuggestion"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrCheckTests() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { NewTests newTests = NewTests.newBuilder().setCurrentTestVersionNo(10).build(); try { boolean bool = AggregatorRetrieve.checkTests(newTests); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();//from w w w. jav a2 s .c o m } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm NewTests"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrRegisterAgent() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { RegisterAgent registerAgent = RegisterAgent.newBuilder().setIp("ip") .setAgentType(Constants.AGENT_TYPE).setVersionNo(10).build(); try { boolean bool = AggregatorRetrieve.registerAgent(registerAgent); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();/*from w w w . j ava 2 s. c o m*/ } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm RegisterAgent"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrSendWebsiteSuggestion() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { WebsiteSuggestion websiteSuggestion = WebsiteSuggestion.newBuilder() .setWebsiteURL("website").build(); try { boolean bool = AggregatorRetrieve.sendWebsiteSuggestion(websiteSuggestion); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();// w w w .ja v a 2s .c o m } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm SendWebsiteSuggestion"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrCheckVersion() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { NewVersion newVersion = NewVersion.newBuilder().setAgentType("MOBILE").setAgentVersionNo(10) .build();/*w ww . j ava2 s . c o m*/ try { boolean bool = AggregatorRetrieve.checkVersion(newVersion); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm NewVersion"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrGetEvents() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { Location location = Location.newBuilder().setLatitude(10.1).setLongitude(10.1).build(); GetEvents getEvents = GetEvents.newBuilder().addLocations(location).build(); try { boolean bool = AggregatorRetrieve.getEvents(getEvents); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace();/*from w ww. jav a2 s. c o m*/ } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm GetEvents"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrSendServiceReport() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { ServiceReportDetail serviceReportDetail = ServiceReportDetail.newBuilder().setBandwidth(10) .setResponseTime(10).setServiceName("service").setStatusCode(10).build(); Trace trace = Trace.newBuilder().setHop(10).setIp("IP").addPacketsTiming(10).build(); TraceRoute traceRoute = TraceRoute.newBuilder().setHops(10).setPacketSize(10).setTarget("target") .addTraces(trace).build(); ICMReport icmReport = ICMReport.newBuilder().setAgentID(Integer.toString(10)) .setReportID(Integer.toString(10)).setTestID("10").setTimeUTC(10).setTimeZone(10) .setTraceroute(traceRoute).addPassedNode("node1").build(); ServiceReport serviceReport = ServiceReport.newBuilder().setHeader(icmReport) .setReport(serviceReportDetail).build(); SendServiceReport sendServiceReport = SendServiceReport.newBuilder().setReport(serviceReport) .build();/* w w w. j a v a 2s.co m*/ try { boolean bool = AggregatorRetrieve.sendServiceReport(sendServiceReport); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm SendServiceReport"; } }); }
From source file:org.umit.icm.mobile.utils.ProfilerRun.java
private static void profileAggrSendWebsiteReport() { Profiler profiler = new Profiler(); profiler.runProfiler(new TaskInterface() { public void task() { WebsiteReportDetail websiteReportDetail = WebsiteReportDetail.newBuilder().setBandwidth(10) .setResponseTime(10).setStatusCode(10).setWebsiteURL("url").build(); Trace trace = Trace.newBuilder().setHop(10).setIp("IP").addPacketsTiming(10).build(); TraceRoute traceRoute = TraceRoute.newBuilder().setHops(10).setPacketSize(10).setTarget("target") .addTraces(trace).build(); ICMReport icmReport = ICMReport.newBuilder().setAgentID(Integer.toString(10)) .setReportID(Integer.toString(10)).setTestID("10").setTimeUTC(10).setTimeZone(10) .setTraceroute(traceRoute).addPassedNode("node1").build(); WebsiteReport websiteReport = WebsiteReport.newBuilder().setHeader(icmReport) .setReport(websiteReportDetail).build(); SendWebsiteReport sendWebsiteReport = SendWebsiteReport.newBuilder().setReport(websiteReport) .build();//from w w w . ja v a 2 s . c o m try { boolean bool = AggregatorRetrieve.sendWebsiteReport(sendWebsiteReport); if (bool == true) Log.w(taskName(), "true"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String taskName() { return "AggrComm SendWebsiteReport"; } }); }
From source file:com.tcl.lzhang1.mymusic.MusicUtil.java
/** * ?HttpPost//from w w w . j a v a 2s .co m * * @param url * Url * @param json * ??? * @return * @throws AppException */ public static HttpPost getHttpPost(String url, JSONObject json) { HttpPost httpPost = null; HttpEntity enity = null; try { httpPost = new HttpPost(url); httpPost.addHeader("Content-Type", "application/json; charset=utf-8"); enity = new StringEntity(json.toString(), "utf-8"); httpPost.setEntity(enity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } finally { if (null != enity) { try { enity.consumeContent(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } enity = null; } } return httpPost; }