Program: 142211
Project: 142211
Buggy source:
/** 
 * TODO: At some point in the future this kind of division will be more central but this generates an input stream for a URL using the best package for your application
 * @param url
 * @return a Stream to that URL 
 */
public InputStream simpleGet(URL url) throws IOException {
  if (android.os.Build.VERSION.SDK_INT > 11) {
    if (passwordAuthentication != null) {
      Authenticator.setDefault(new Authenticator(){
        @Override protected PasswordAuthentication getPasswordAuthentication(){
          return passwordAuthentication;
        }
      }
);
    }
    int responseCode=-1;
    HttpURLConnection con=(HttpURLConnection)url.openConnection();
    setup(con);
    con.connect();
    try {
      responseCode=con.getResponseCode();
      if (responseCode == 301) {
        Logger.log(AndroidLogger.TYPE_WARNING_NETWORK,"String_Node_Str" + url.toString() + "String_Node_Str"+ con.getURL().toString());
        URL newUrl=con.getURL();
        con.disconnect();
        con=(HttpURLConnection)newUrl.openConnection();
        setup(con);
        con.connect();
      }
      if (!HttpRequestGenerator.isValidRedirect(url,con.getURL())) {
        Logger.log(AndroidLogger.TYPE_WARNING_NETWORK,"String_Node_Str" + url.toString() + "String_Node_Str"+ con.getURL().toString());
        throw new IOException("String_Node_Str");
      }
      return con.getInputStream();
    }
 catch (    IOException e) {
      if (e.getMessage().toLowerCase().contains("String_Node_Str") || responseCode == 401) {
      }
 else {
        throw e;
      }
    }
  }
  Log.i(LOG_COMMCARE_NETWORK,"String_Node_Str");
  HttpResponse get=get(url.toString());
  if (get.getStatusLine().getStatusCode() == 404) {
    throw new FileNotFoundException("String_Node_Str" + url.toString());
  }
  return get.getEntity().getContent();
}

Fixed version (ground truth):
/** 
 * TODO: At some point in the future this kind of division will be more central but this generates an input stream for a URL using the best package for your application
 * @return a Stream to that URL
 */
public InputStream simpleGet(URL url) throws IOException {
  if (android.os.Build.VERSION.SDK_INT > 11) {
    if (passwordAuthentication != null) {
      Authenticator.setDefault(new Authenticator(){
        @Override protected PasswordAuthentication getPasswordAuthentication(){
          return passwordAuthentication;
        }
      }
);
    }
    int responseCode=-1;
    HttpURLConnection con=(HttpURLConnection)url.openConnection();
    setup(con);
    con.connect();
    try {
      responseCode=con.getResponseCode();
      if (responseCode == 301) {
        Logger.log(AndroidLogger.TYPE_WARNING_NETWORK,"String_Node_Str" + url.toString() + "String_Node_Str"+ con.getURL().toString());
        URL newUrl=con.getURL();
        con.disconnect();
        con=(HttpURLConnection)newUrl.openConnection();
        setup(con);
        con.connect();
      }
      if (!HttpRequestGenerator.isValidRedirect(url,con.getURL())) {
        Logger.log(AndroidLogger.TYPE_WARNING_NETWORK,"String_Node_Str" + url.toString() + "String_Node_Str"+ con.getURL().toString());
        throw new IOException("String_Node_Str");
      }
      return con.getInputStream();
    }
 catch (    IOException e) {
      if (e.getMessage().toLowerCase().contains("String_Node_Str") || responseCode == 401) {
      }
 else {
        throw e;
      }
    }
  }
  Log.i(LOG_COMMCARE_NETWORK,"String_Node_Str");
  HttpResponse get=get(url.toString());
  if (get.getStatusLine().getStatusCode() == 404) {
    throw new FileNotFoundException("String_Node_Str" + url.toString());
  }
  return get.getEntity().getContent();
}