Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 07-28 22:14:09.269 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 07-28 22:14:10.713 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 07-28 22:14:13.808 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 07-28 22:14:21.167 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 07-28 22:14:24.932 719-736/system_process E/BatteryStatsService: no controller energy info supplied
- 07-28 22:14:44.322 1794-1892/com.lavazza E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #10
- Process: com.lavazza, PID: 1794
- java.lang.RuntimeException: An error occurred while executing doInBackground()
- at android.os.AsyncTask$3.done(AsyncTask.java:325)
- at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
- at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
- at java.util.concurrent.FutureTask.run(FutureTask.java:242)
- at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
- at java.lang.Thread.run(Thread.java:761)
- 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)
- at com.lavazza.CreateIncidentActivity$CreateIncident.doInBackground(CreateIncidentActivity.java:565)
- at com.lavazza.CreateIncidentActivity$CreateIncident.doInBackground(CreateIncidentActivity.java:510)
- at android.os.AsyncTask$2.call(AsyncTask.java:305)
- at java.util.concurrent.FutureTask.run(FutureTask.java:237)
- at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
- at java.lang.Thread.run(Thread.java:761)
- 07-28 22:14:44.434 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 07-28 22:14:44.856 719-1904/system_process E/EGL_emulation: tid 1904: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 07-28 22:14:46.027 1794-1824/com.lavazza E/EGL_emulation: tid 1824: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
- 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
- at android.view.ViewRootImpl.<init>(ViewRootImpl.java:418)
- at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:331)
- at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
- at android.app.Dialog.show(Dialog.java:322)
- at com.lavazza.CreateIncidentActivity$CreateIncident.onPreExecute(CreateIncidentActivity.java:538)
- at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:620)
- at android.os.AsyncTask.execute(AsyncTask.java:567)
- at com.lavazza.CreateIncidentActivity$7.onClick(CreateIncidentActivity.java:269)
- at android.view.View.performClick(View.java:5637)
- at android.view.View$PerformClick.run(View.java:22429)
- at android.os.Handler.handleCallback(Handler.java:751)
- at android.os.Handler.dispatchMessage(Handler.java:95)
- at android.os.Looper.loop(Looper.java:154)
- at android.app.ActivityThread.main(ActivityThread.java:6119)
- at java.lang.reflect.Method.invoke(Native Method)
- at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
- 07-28 22:14:50.152 719-789/system_process E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
- 07-28 22:15:25.017 719-736/system_process E/BatteryStatsService: power: Missing API
- 07-28 22:15:25.018 719-736/system_process E/BluetoothAdapter: Bluetooth binder is null
- 07-28 22:15:25.018 719-736/system_process E/BatteryStatsService: no controller energy info supplied
- private class CreateIncident extends AsyncTask<Void, Void, JSONObject> {
- private final String TAG = "HttpClient";
- final String user ="some_user";
- final String password ="some_pwd";
- String url;
- JSONObject jsonObjSend;
- public CreateIncident(String url, JSONObject jsonObjSend) {
- this.url = url;
- this.jsonObjSend = jsonObjSend;
- }
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- // Showing progress dialog
- pDialog = new ProgressDialog(CreateIncidentActivity.this);
- pDialog.setMessage("Please wait...");
- pDialog.setCancelable(false);
- pDialog.show();
- }
- @Override
- protected JSONObject doInBackground(Void... params) {
- JSONObject jsonObjRecv = null;
- try {
- String authString = user + ":" + password;
- byte[] authBytes = authString.getBytes();
- String authStringEnc = Base64.encodeToString(authBytes, Base64.DEFAULT);
- DefaultHttpClient httpclient = new DefaultHttpClient();
- HttpPost httpPostRequest = new HttpPost(url);
- StringEntity se;
- se = new StringEntity(jsonObjSend.toString());
- // Set HTTP parameters
- httpPostRequest.setEntity(se);
- httpPostRequest.setHeader("Authorization", "Basic " + authStringEnc);
- httpPostRequest.setHeader("Accept", "application/json");
- httpPostRequest.setHeader("Content-type", "application/json");
- long t = System.currentTimeMillis();
- HttpResponse response = (HttpResponse) httpclient.execute(httpPostRequest); //getting error_line after debugging
- Log.i(TAG, "HTTPResponse received in [" + (System.currentTimeMillis()-t) + "ms]");
- HttpEntity entity = response.getEntity();
- if (entity != null) {
- // Read the content stream
- InputStream instream = entity.getContent();
- // convert content stream to a String
- String resultString= convertStreamToString(instream);
- instream.close();
- resultString = resultString.substring(1,resultString.length()-1); // remove wrapping "[" and "]"
- jsonObjRecv = new JSONObject(resultString);
- // Raw DEBUG output of our received JSON object:
- Log.i(TAG,"<JSONObject>n"+jsonObjRecv.toString()+"n</JSONObject>");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return jsonObjRecv;
- }
- private String convertStreamToString(InputStream is) {
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- StringBuilder sb = new StringBuilder();
- String line = null;
- try {
- while ((line = reader.readLine()) != null) {
- sb.append(line).append('n');
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return sb.toString();
- }
- @Override
- protected void onPostExecute(JSONObject result) { //changed Void to JSONObject
- super.onPostExecute(result);
- // Dismiss the progress dialog
- if (pDialog.isShowing())
- pDialog.dismiss();
- if(result != null)
- Toast.makeText(getApplicationContext(),"result after POST===> "+result.toString(),Toast.LENGTH_SHORT).show();
- else
- Toast.makeText(getApplicationContext(),"result after POST===> null",Toast.LENGTH_SHORT).show();
- Toast.makeText(getApplicationContext(),"Bravo!!! Success!!!",Toast.LENGTH_SHORT).show();
- }
- }
- public void onClick(View v) {
- inputSub = subIn.getText().toString();
- String url = "https://some_url";
- JSONObject incidentData = null;
- try {
- String inputJson = "{ "asset": {"id":" + choosedAssetId + " },"
- + " "assignedTo": {"
- + " "account": {"
- + " "id":" + choosedAccId
- + " }"
- + " },"
- + " "category":{"
- + " "id":" + choosedCategId
- + " },"
- + " "customFields":{"
- + " "c":{"
- + " "travel_required":" + null
- + " }"
- + " },"
- + " "organization":{"
- + " "id":" + orgId
- + " },"
- + " "primaryContact":{"
- + " "id":" + contId
- + " },"
- + " "subject":"" + inputSub + """
- + "}";
- incidentData = new JSONObject(inputJson);
- }catch (JSONException e){
- e.printStackTrace();
- }
- new CreateIncident(url, incidentData).execute();
- }
- public AsyncTask() {
- mWorker = new WorkerRunnable<Params, Result>() {
- public Result call() throws Exception {
- mTaskInvoked.set(true);
- Result result = null;
- try {
- Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
- //noinspection unchecked
- result = doInBackground(mParams);
- Binder.flushPendingCommands();
- } catch (Throwable tr) { //after httpclient.execute method this line is executed
- mCancelled.set(true);
- throw tr;
- } finally {
- postResult(result);
- }
- return result;
- }
Add Comment
Please, Sign In to add comment