title: java.lang.NullPointerException: lock == null while get json file from server
body: <p>I got following error. java.lang.NullPointerException: lock == null while get json file from server.I googled but cant find any solution for this.</p>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>try {
              // defaultHttpClient
              DefaultHttpClient httpClient = new DefaultHttpClient();
              HttpPost httpPost = new HttpPost(url);
  
              Log.i("clock", httpPost.getURI().toString());
              HttpResponse httpResponse = httpClient.execute(httpPost);
              HttpEntity httpEntity = httpResponse.getEntity();
              is = httpEntity.getContent();           
  
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          try {
              Log.i("Buffer", "1");
              BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
              Log.i("Buffer", "2");
              StringBuilder sb = new StringBuilder();
              Log.i("Buffer", "3");
              String line = null;
              Log.i("Buffer", "4");
              while ((line = reader.readLine()) != null) {
                  sb.append(line + "\n");
              }
              is.close();
              Log.i("Buffer", "5");
              json = sb.toString();
              Log.i("Buffer", "6-&gt;"+json);
          } catch (Exception e) {
              Log.e("Buffer Error", "Error converting result-&gt; " + e.toString());
          }
  </code></pre>
  
  <p><strong>Logcat:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/IdUTR.jpg" alt="enter image description here"></p>