Guest User

Untitled

a guest
Jul 28th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.95 KB | None | 0 0
  1. 07-28 22:14:09.269 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  2. 07-28 22:14:10.713 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  3. 07-28 22:14:13.808 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  4. 07-28 22:14:21.167 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  5. 07-28 22:14:24.932 719-736/system_process E/BatteryStatsService: no controller energy info supplied
  6. 07-28 22:14:44.322 1794-1892/com.lavazza E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #10
  7. Process: com.lavazza, PID: 1794
  8. java.lang.RuntimeException: An error occurred while executing doInBackground()
  9. at android.os.AsyncTask$3.done(AsyncTask.java:325)
  10. at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
  11. at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
  12. at java.util.concurrent.FutureTask.run(FutureTask.java:242)
  13. at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
  14. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
  15. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
  16. at java.lang.Thread.run(Thread.java:761)
  17. Caused by: java.lang.NoSuchMethodError: No virtual method execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse; in class Lorg/apache/http/impl/client/DefaultHttpClient; or its super classes (declaration of 'org.apache.http.impl.client.DefaultHttpClient' appears in /system/framework/org.apache.http.legacy.boot.jar)
  18. at com.lavazza.CreateIncidentActivity$CreateIncident.doInBackground(CreateIncidentActivity.java:565)
  19. at com.lavazza.CreateIncidentActivity$CreateIncident.doInBackground(CreateIncidentActivity.java:510)
  20. at android.os.AsyncTask$2.call(AsyncTask.java:305)
  21. at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  22. at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
  23. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
  24. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
  25. at java.lang.Thread.run(Thread.java:761) 
  26. 07-28 22:14:44.434 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  27. 07-28 22:14:44.856 719-1904/system_process E/EGL_emulation: tid 1904: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  28. 07-28 22:14:46.027 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
  29. 07-28 22:14:47.030 1794-1794/com.lavazza E/WindowManager: android.view.WindowLeaked: Activity com.lavazza.CreateIncidentActivity has leaked window DecorView@2849ee4[] that was originally added here
  30. at android.view.ViewRootImpl.<init>(ViewRootImpl.java:418)
  31. at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:331)
  32. at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
  33. at android.app.Dialog.show(Dialog.java:322)
  34. at com.lavazza.CreateIncidentActivity$CreateIncident.onPreExecute(CreateIncidentActivity.java:538)
  35. at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:620)
  36. at android.os.AsyncTask.execute(AsyncTask.java:567)
  37. at com.lavazza.CreateIncidentActivity$7.onClick(CreateIncidentActivity.java:269)
  38. at android.view.View.performClick(View.java:5637)
  39. at android.view.View$PerformClick.run(View.java:22429)
  40. at android.os.Handler.handleCallback(Handler.java:751)
  41. at android.os.Handler.dispatchMessage(Handler.java:95)
  42. at android.os.Looper.loop(Looper.java:154)
  43. at android.app.ActivityThread.main(ActivityThread.java:6119)
  44. at java.lang.reflect.Method.invoke(Native Method)
  45. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
  46. at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
  47. 07-28 22:14:50.152 719-789/system_process E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
  48. 07-28 22:15:25.017 719-736/system_process E/BatteryStatsService: power: Missing API
  49. 07-28 22:15:25.018 719-736/system_process E/BluetoothAdapter: Bluetooth binder is null
  50. 07-28 22:15:25.018 719-736/system_process E/BatteryStatsService: no controller energy info supplied
  51.  
  52. private class CreateIncident extends AsyncTask<Void, Void, JSONObject> {
  53. private final String TAG = "HttpClient";
  54.  
  55. final String user ="some_user";
  56. final String password ="some_pwd";
  57.  
  58. String url;
  59. JSONObject jsonObjSend;
  60.  
  61. public CreateIncident(String url, JSONObject jsonObjSend) {
  62. this.url = url;
  63. this.jsonObjSend = jsonObjSend;
  64. }
  65.  
  66. @Override
  67. protected void onPreExecute() {
  68. super.onPreExecute();
  69.  
  70. // Showing progress dialog
  71. pDialog = new ProgressDialog(CreateIncidentActivity.this);
  72. pDialog.setMessage("Please wait...");
  73. pDialog.setCancelable(false);
  74. pDialog.show();
  75. }
  76.  
  77. @Override
  78. protected JSONObject doInBackground(Void... params) {
  79. JSONObject jsonObjRecv = null;
  80.  
  81. try {
  82. String authString = user + ":" + password;
  83. byte[] authBytes = authString.getBytes();
  84. String authStringEnc = Base64.encodeToString(authBytes, Base64.DEFAULT);
  85.  
  86. DefaultHttpClient httpclient = new DefaultHttpClient();
  87. HttpPost httpPostRequest = new HttpPost(url);
  88.  
  89. StringEntity se;
  90. se = new StringEntity(jsonObjSend.toString());
  91.  
  92. // Set HTTP parameters
  93. httpPostRequest.setEntity(se);
  94. httpPostRequest.setHeader("Authorization", "Basic " + authStringEnc);
  95. httpPostRequest.setHeader("Accept", "application/json");
  96. httpPostRequest.setHeader("Content-type", "application/json");
  97.  
  98. long t = System.currentTimeMillis();
  99. HttpResponse response = (HttpResponse) httpclient.execute(httpPostRequest); //getting error_line after debugging
  100. Log.i(TAG, "HTTPResponse received in [" + (System.currentTimeMillis()-t) + "ms]");
  101.  
  102. HttpEntity entity = response.getEntity();
  103.  
  104. if (entity != null) {
  105. // Read the content stream
  106. InputStream instream = entity.getContent();
  107.  
  108. // convert content stream to a String
  109. String resultString= convertStreamToString(instream);
  110. instream.close();
  111. resultString = resultString.substring(1,resultString.length()-1); // remove wrapping "[" and "]"
  112.  
  113. jsonObjRecv = new JSONObject(resultString);
  114.  
  115. // Raw DEBUG output of our received JSON object:
  116. Log.i(TAG,"<JSONObject>n"+jsonObjRecv.toString()+"n</JSONObject>");
  117.  
  118. }
  119. } catch (Exception e) {
  120. e.printStackTrace();
  121. }
  122. return jsonObjRecv;
  123. }
  124.  
  125. private String convertStreamToString(InputStream is) {
  126. BufferedReader reader = new BufferedReader(new InputStreamReader(is));
  127. StringBuilder sb = new StringBuilder();
  128.  
  129. String line = null;
  130. try {
  131. while ((line = reader.readLine()) != null) {
  132. sb.append(line).append('n');
  133. }
  134. } catch (IOException e) {
  135. e.printStackTrace();
  136. } finally {
  137. try {
  138. is.close();
  139. } catch (IOException e) {
  140. e.printStackTrace();
  141. }
  142. }
  143. return sb.toString();
  144. }
  145.  
  146. @Override
  147. protected void onPostExecute(JSONObject result) { //changed Void to JSONObject
  148. super.onPostExecute(result);
  149. // Dismiss the progress dialog
  150. if (pDialog.isShowing())
  151. pDialog.dismiss();
  152.  
  153. if(result != null)
  154. Toast.makeText(getApplicationContext(),"result after POST===> "+result.toString(),Toast.LENGTH_SHORT).show();
  155. else
  156. Toast.makeText(getApplicationContext(),"result after POST===> null",Toast.LENGTH_SHORT).show();
  157.  
  158. Toast.makeText(getApplicationContext(),"Bravo!!! Success!!!",Toast.LENGTH_SHORT).show();
  159. }
  160. }
  161.  
  162. public void onClick(View v) {
  163. inputSub = subIn.getText().toString();
  164.  
  165. String url = "https://some_url";
  166. JSONObject incidentData = null;
  167.  
  168. try {
  169.  
  170.  
  171. String inputJson = "{ "asset": {"id":" + choosedAssetId + " },"
  172. + " "assignedTo": {"
  173. + " "account": {"
  174. + " "id":" + choosedAccId
  175. + " }"
  176. + " },"
  177. + " "category":{"
  178. + " "id":" + choosedCategId
  179. + " },"
  180. + " "customFields":{"
  181. + " "c":{"
  182. + " "travel_required":" + null
  183. + " }"
  184. + " },"
  185. + " "organization":{"
  186. + " "id":" + orgId
  187. + " },"
  188. + " "primaryContact":{"
  189. + " "id":" + contId
  190. + " },"
  191. + " "subject":"" + inputSub + """
  192. + "}";
  193.  
  194. incidentData = new JSONObject(inputJson);
  195.  
  196. }catch (JSONException e){
  197. e.printStackTrace();
  198. }
  199.  
  200. new CreateIncident(url, incidentData).execute();
  201. }
  202.  
  203. public AsyncTask() {
  204. mWorker = new WorkerRunnable<Params, Result>() {
  205. public Result call() throws Exception {
  206. mTaskInvoked.set(true);
  207. Result result = null;
  208. try {
  209. Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
  210. //noinspection unchecked
  211. result = doInBackground(mParams);
  212. Binder.flushPendingCommands();
  213. } catch (Throwable tr) { //after httpclient.execute method this line is executed
  214. mCancelled.set(true);
  215. throw tr;
  216. } finally {
  217. postResult(result);
  218. }
  219. return result;
  220. }
Add Comment
Please, Sign In to add comment