title: java.lang.RuntimeException:An error occured while executing doInBackground()
body: <p>I have seen and other relevant posts and I understand that the error is in doInBackground method moreover understands and from mistakes occurring, but I can't understand which place of code I must change or to convey onPostExecute method.If someone has some idea what's this I should change to code, thanks. The following is the code of doInBackground method etc.</p>
  
  <pre><code>protected String doInBackground(String... args) {
          // Building Parameters
          List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
          // getting JSON string from URL
          JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params);
  
          // Check your log cat for JSON response
          Log.d("All products:",json.toString()); //141 line
  
          try {
              // Checking for SUCCESS TAG
              int success = json.getInt(TAG_SUCCESS);
  
              if (success == 1) {
                  // products found
                  // Getting Array of Products
                  products = json.getJSONArray(TAG_CLASSES);
  
                  // looping through All Products
                  for (int i = 0; i &lt; products.length(); i++) {
                      JSONObject c = products.getJSONObject(i);
  
                      // Storing each json item in variable
                      String id = c.getString(TAG_PID);
                      String name = c.getString(TAG_NAME);
  
                      // creating new HashMap
                      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
                      // adding each child node to HashMap key =&gt; value
                      map.put(TAG_PID, id);
                      map.put(TAG_NAME, name);
  
                      // adding HashList to ArrayList
                      productsList.add(map);
                  }
              } else {
                  // no products found
                  // Launch Add New product Activity
                  Intent i = new Intent(getApplicationContext(),NewProductActivity.class);
                  // Closing all previous activities
                  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                  startActivity(i);
              }
          } catch (JSONException e) {
              e.printStackTrace();
          }
  
       return null;
      }
  
      /**
       * After completing background task Dismiss the progress dialog
       * **/
      protected void onPostExecute(String file_url) {
          // dismiss the dialog after getting all products
          pDialog.dismiss();
          // updating UI from Background Thread
          runOnUiThread(new Runnable() {
              public void run() {
                  /**
                   * Updating parsed JSON data into ListView
                   * */
                  ListAdapter adapter = new SimpleAdapter(
                          AllProductsActivity.this, productsList,
                          R.layout.list_item, new String[] { TAG_PID,
                                  TAG_NAME},
                          new int[] { R.id.id, R.id.name });
                  // updating listview
                  setListAdapter(adapter);
              }
          });
  
      }
  
  }
  </code></pre>
  
  <p>And the following is the ERRORS</p>
  
  <pre><code>06-05 20:06:49.454: E/Buffer Error(1981): Error converting result       java.lang.NullPointerException: lock == null
  06-05 20:06:49.509: E/JSON Parser(1981): Error parsing data org.json.JSONException: End of input at character 0 of 
  06-05 20:06:49.584: W/dalvikvm(1981): threadid=10: thread exiting with uncaught exception (group=0xb4da3908)
  06-05 20:06:49.664: E/AndroidRuntime(1981): FATAL EXCEPTION: AsyncTask #1
  06-05 20:06:49.664: E/AndroidRuntime(1981): java.lang.RuntimeException: An error occurred while executing doInBackground()
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at java.util.concurrent.FutureTask.run(FutureTask.java:239)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at jav a.lang.Thread.run(Thread.java:856)
  06-05 20:06:49.664: E/AndroidRuntime(1981): Caused by: java.lang.NullPointerException
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at com.panos.appphpconnect.AllProductsActivity$LoadAllProducts.doInBackground(AllProductsActivity.java:141)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at com.panos.appphpconnect.AllProductsActivity$LoadAllProducts.doInBackground(AllProductsActivity.java:1)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  06-05 20:06:49.664: E/AndroidRuntime(1981):     ... 4 more
  06-05 20:07:03.554: W/Trace(1981): Unexpected value from nativeGetEnabledTags: 0
  </code></pre>