title: FileNotFoundException for HttpURLConnection in Ice Cream Sandwich
body: <p>I have an Android app that works fine with Android 2.x and 3.x, but it fails when run on Android 4.x.</p>
  
  <p>The problem is in this section of code:</p>
  
  <pre><code>URL url = new URL("http://blahblah.blah/somedata.xml");
  HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  urlConnection.setRequestMethod("GET");
  urlConnection.setDoOutput(true);
  urlConnection.connect();
  
  InputStream inputStream = urlConnection.getInputStream();
  </code></pre>
  
  <p>When the application is running on Android 4.x, the <code>getInputStream()</code> call results in a <code>FileNotFoundException</code>. When the same binary is running on earlier versions of Android, it succeeds. The URLs also work fine in web browsers and with <code>curl</code>.</p>
  
  <p>Apparently something about <code>HttpURLConnection</code> has changed in ICS. Does anybody have any idea what has changed, and/or what the fix might be?</p>