title: HTTP error 500 on Android
body: <p>So here is my code, its purpose is to fecth a json file. I get an error 500 from the server, which means I know that it is an internal server error. As I can't access to the logs of the the server, I'm pretty much stuck from now... I read about session and cookies, maybe that's it. What do you guy think of it ?</p>
  
  <pre><code>private class ListingFetcher extends AsyncTask&lt;Void, Void, String&gt; {
      private static final String TAG = "ListingFetcher";
      public static final String SERVER_URL = "http://www.myurl.com/listing.json";
  
      @Override
      protected String doInBackground(Void... params) {
          try {
              //Create an HTTP client
              HttpClient client = new DefaultHttpClient();
              HttpPost post = new HttpPost(SERVER_URL);
  
              //Perform the request and check the status code
              HttpResponse response = client.execute(post);
              StatusLine statusLine = response.getStatusLine();
              if(statusLine.getStatusCode() == 200) {
                  HttpEntity entity = response.getEntity();
                  InputStream content = entity.getContent();
  
                  try {
                      //Read the server response and attempt to parse it as JSON
                      Reader reader = new InputStreamReader(content);
  
                      GsonBuilder gsonBuilder = new GsonBuilder();
                                              gsonBuilder.setDateFormat("M/d/yy hh:mm a");
                      Gson gson = gsonBuilder.create();
                      List&lt;Listing&gt; events = new ArrayList&lt;Listing&gt;();
                      events = Arrays.asList(gson.fromJson(reader, Listing[].class));
                      content.close();
  
                      handlePostsList(events);
                  } catch (Exception ex) {
                      Log.e(TAG, "Failed to parse JSON due to: " + ex);
                      failedLoadingPosts();
                  }
              } else {
                  Log.e(TAG, "Server responded with status code: " + statusLine.getStatusCode());
                  failedLoadingPosts();
              }
          } catch(Exception ex) {
              Log.e(TAG, "Failed to send HTTP POST request due to: " + ex);
              failedLoadingPosts();
          }
          return null;
      } 
  }
  </code></pre>