Program: 3190
Project: 3190
Buggy source:
public FetchResult updateData(Context context,boolean force){
  DBOpenHelper dbhelper=new DBOpenHelper(context);
  SQLiteDatabase db=dbhelper.getWritableDatabase();
  try {
    if (!isOnline(context)) {
      Log.d(TAG,"String_Node_Str");
      return FetchResult.NOTONLINE;
    }
  }
 catch (  Exception e) {
    exceptionReporter.reportException(Thread.currentThread(),e,"String_Node_Str");
  }
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(context);
  if (!force) {
    try {
      if (sp.getBoolean("String_Node_Str",false) == true) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.LOGINFAILED;
      }
      if (sp.getBoolean("String_Node_Str",true) == false) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
      if (!isBackgroundDataEnabled(context) && sp.getBoolean("String_Node_Str",true)) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
      if (!isAutoSyncEnabled() && sp.getBoolean("String_Node_Str",true) && sp.getBoolean("String_Node_Str",true)) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
      if (isWifi(context) && !sp.getBoolean("String_Node_Str",true)) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
 else       if (!isWifi(context)) {
        Log.d(TAG,"String_Node_Str");
        if (!isRoaming(context) && !sp.getBoolean("String_Node_Str",true)) {
          Log.d(TAG,"String_Node_Str");
          DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
          return FetchResult.NOTALLOWED;
        }
 else         if (isRoaming(context) && !sp.getBoolean("String_Node_Str",false)) {
          Log.d(TAG,"String_Node_Str");
          DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
          return FetchResult.NOTALLOWED;
        }
      }
    }
 catch (    Exception e) {
      exceptionReporter.reportException(Thread.currentThread(),e,"String_Node_Str");
    }
  }
 else {
    Log.d(TAG,"String_Node_Str");
  }
  try {
    String username=sp.getString("String_Node_Str",null);
    String password=sp.getString("String_Node_Str",null);
    if (username == null || password == null) {
      DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
      return FetchResult.USERNAMEPASSWORDNOTSET;
    }
    Log.d(TAG,"String_Node_Str");
    HttpGetter loginPageGet=new HttpGetter("String_Node_Str");
    String loginPageString=loginPageGet.execute();
    if (loginPageString != null) {
      Document loginPage=Jsoup.parse(loginPageString,"String_Node_Str");
      Element loginForm=loginPage.getElementsByAttributeValue("String_Node_Str","String_Node_Str").first();
      String loginAction=loginForm.attr("String_Node_Str");
      List<NameValuePair> loginValues=new ArrayList<NameValuePair>();
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str",username));
      loginValues.add(new BasicNameValuePair("String_Node_Str",password));
      Log.d(TAG,"String_Node_Str");
      HttpPoster sendLoginPoster=new HttpPoster(loginAction,loginValues);
      Document homePage=Jsoup.parse(sendLoginPoster.execute());
      boolean postPaid;
      if (homePage.getElementById("String_Node_Str") == null) {
        Log.d(TAG,"String_Node_Str");
        postPaid=false;
      }
 else {
        Log.d(TAG,"String_Node_Str");
        postPaid=true;
      }
      Element accountSummary=homePage.getElementById("String_Node_Str");
      if (accountSummary == null) {
        Log.d(TAG,"String_Node_Str");
        return FetchResult.LOGINFAILED;
      }
      db.delete("String_Node_Str","String_Node_Str",null);
      Element accountSummaryTable=accountSummary.getElementsByClass("String_Node_Str").first();
      Elements rows=accountSummaryTable.getElementsByTag("String_Node_Str");
      for (      Element row : rows) {
        Double value;
        String units;
        try {
          Element amount=row.getElementsByClass("String_Node_Str").first();
          String amountHTML=amount.html();
          String[] amountParts=amountHTML.split("String_Node_Str",2);
          if (amountParts[0].contains("String_Node_Str") || amountParts[0].equals("String_Node_Str")) {
            value=Values.INCLUDED;
          }
 else {
            try {
              value=Double.parseDouble(amountParts[0]);
            }
 catch (            NumberFormatException e) {
              exceptionReporter.reportException(Thread.currentThread(),e,"String_Node_Str");
              value=0.0;
            }
          }
          units=amountParts[1];
        }
 catch (        NullPointerException e) {
          value=null;
          units=null;
        }
        Element details=row.getElementsByClass("String_Node_Str").first();
        String name=details.getElementsByTag("String_Node_Str").first().text();
        Element expires=details.getElementsByTag("String_Node_Str").first();
        String expiresDetails="String_Node_Str";
        if (expires != null) {
          expiresDetails=expires.text();
        }
        Log.d(TAG,expiresDetails);
        Pattern pattern;
        if (postPaid == false) {
          pattern=Pattern.compile("String_Node_Str");
        }
 else {
          pattern=Pattern.compile("String_Node_Str");
        }
        Matcher matcher=pattern.matcher(expiresDetails);
        Double expiresValue=null;
        String expiresDate=null;
        if (matcher.find()) {
          try {
            expiresValue=Double.parseDouble(matcher.group(1));
          }
 catch (          NumberFormatException e) {
            expiresValue=null;
          }
          String expiresDateString=matcher.group(2);
          Date expiresDateObj;
          if (expiresDateString != null) {
            if (expiresDateString.length() > 0) {
              try {
                expiresDateObj=DateFormatters.EXPIRESDATE.parse(expiresDateString);
                expiresDate=DateFormatters.ISO8601DATEONLYFORMAT.format(expiresDateObj);
              }
 catch (              java.text.ParseException e) {
                Log.d(TAG,"String_Node_Str" + expiresDateString);
              }
            }
          }
        }
        ContentValues values=new ContentValues();
        values.put("String_Node_Str",name);
        values.put("String_Node_Str",value);
        values.put("String_Node_Str",units);
        values.put("String_Node_Str",expiresValue);
        values.put("String_Node_Str",expiresDate);
        db.insert("String_Node_Str","String_Node_Str",values);
      }
      if (postPaid == false) {
        Log.d(TAG,"String_Node_Str");
        HttpGetter valuePacksPageGet=new HttpGetter("String_Node_Str");
        String valuePacksPageString=valuePacksPageGet.execute();
        if (valuePacksPageString != null) {
          Document valuePacksPage=Jsoup.parse(valuePacksPageString);
          Elements enabledPacks=valuePacksPage.getElementsByClass("String_Node_Str");
          for (          Element enabledPack : enabledPacks) {
            Element offerNameElemt=enabledPack.getElementsByAttributeValueStarting("String_Node_Str","String_Node_Str").first();
            String offerName=offerNameElemt.val();
            DBLog.insertMessage(context,"String_Node_Str","String_Node_Str","String_Node_Str" + offerName);
            ValuePack[] packs=Values.valuePacks.get(offerName);
            if (packs == null) {
              DBLog.insertMessage(context,"String_Node_Str","String_Node_Str","String_Node_Str" + offerName + "String_Node_Str");
            }
 else {
              for (              ValuePack pack : packs) {
                ContentValues values=new ContentValues();
                values.put("String_Node_Str",pack.value);
                values.put("String_Node_Str",offerName);
                DBLog.insertMessage(context,"String_Node_Str","String_Node_Str","String_Node_Str" + pack.type.id + "String_Node_Str"+ pack.value);
                db.update("String_Node_Str",values,"String_Node_Str" + pack.type.id + "String_Node_Str",null);
              }
            }
          }
        }
      }
      SharedPreferences.Editor prefedit=sp.edit();
      Date now=new Date();
      prefedit.putString("String_Node_Str",DateFormatters.ISO8601FORMAT.format(now));
      prefedit.putBoolean("String_Node_Str",false);
      prefedit.putBoolean("String_Node_Str",false);
      prefedit.commit();
      DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
      return FetchResult.SUCCESS;
    }
  }
 catch (  ClientProtocolException e) {
    DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str" + e.getMessage());
    return FetchResult.NETWORKERROR;
  }
catch (  IOException e) {
    DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str" + e.getMessage());
    return FetchResult.NETWORKERROR;
  }
 finally {
    db.close();
  }
  return null;
}

Fixed version (ground truth):
public FetchResult updateData(Context context,boolean force){
  DBOpenHelper dbhelper=new DBOpenHelper(context);
  SQLiteDatabase db=dbhelper.getWritableDatabase();
  try {
    if (!isOnline(context)) {
      Log.d(TAG,"String_Node_Str");
      return FetchResult.NOTONLINE;
    }
  }
 catch (  Exception e) {
    exceptionReporter.reportException(Thread.currentThread(),e,"String_Node_Str");
  }
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(context);
  if (!force) {
    try {
      if (sp.getBoolean("String_Node_Str",false) == true) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.LOGINFAILED;
      }
      if (sp.getBoolean("String_Node_Str",true) == false) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
      if (!isBackgroundDataEnabled(context) && sp.getBoolean("String_Node_Str",true)) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
      if (!isAutoSyncEnabled() && sp.getBoolean("String_Node_Str",true) && sp.getBoolean("String_Node_Str",true)) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
      if (isWifi(context) && !sp.getBoolean("String_Node_Str",true)) {
        Log.d(TAG,"String_Node_Str");
        DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
        return FetchResult.NOTALLOWED;
      }
 else       if (!isWifi(context)) {
        Log.d(TAG,"String_Node_Str");
        if (!isRoaming(context) && !sp.getBoolean("String_Node_Str",true)) {
          Log.d(TAG,"String_Node_Str");
          DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
          return FetchResult.NOTALLOWED;
        }
 else         if (isRoaming(context) && !sp.getBoolean("String_Node_Str",false)) {
          Log.d(TAG,"String_Node_Str");
          DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
          return FetchResult.NOTALLOWED;
        }
      }
    }
 catch (    Exception e) {
      exceptionReporter.reportException(Thread.currentThread(),e,"String_Node_Str");
    }
  }
 else {
    Log.d(TAG,"String_Node_Str");
  }
  try {
    String username=sp.getString("String_Node_Str",null);
    String password=sp.getString("String_Node_Str",null);
    if (username == null || password == null) {
      DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
      return FetchResult.USERNAMEPASSWORDNOTSET;
    }
    Log.d(TAG,"String_Node_Str");
    HttpGetter loginPageGet=new HttpGetter("String_Node_Str");
    String loginPageString=loginPageGet.execute();
    if (loginPageString != null) {
      Document loginPage=Jsoup.parse(loginPageString,"String_Node_Str");
      Element loginForm=loginPage.getElementsByAttributeValue("String_Node_Str","String_Node_Str").first();
      String loginAction=loginForm.attr("String_Node_Str");
      List<NameValuePair> loginValues=new ArrayList<NameValuePair>();
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str","String_Node_Str"));
      loginValues.add(new BasicNameValuePair("String_Node_Str",username));
      loginValues.add(new BasicNameValuePair("String_Node_Str",password));
      Log.d(TAG,"String_Node_Str");
      HttpPoster sendLoginPoster=new HttpPoster(loginAction,loginValues);
      Document homePage=Jsoup.parse(sendLoginPoster.execute());
      boolean postPaid;
      if (homePage.getElementById("String_Node_Str") == null) {
        Log.d(TAG,"String_Node_Str");
        postPaid=false;
      }
 else {
        Log.d(TAG,"String_Node_Str");
        postPaid=true;
      }
      Element accountSummary=homePage.getElementById("String_Node_Str");
      if (accountSummary == null) {
        Log.d(TAG,"String_Node_Str");
        return FetchResult.LOGINFAILED;
      }
      db.delete("String_Node_Str","String_Node_Str",null);
      Element accountSummaryTable=accountSummary.getElementsByClass("String_Node_Str").first();
      Elements rows=accountSummaryTable.getElementsByTag("String_Node_Str");
      for (      Element row : rows) {
        Double value;
        String units;
        try {
          Element amount=row.getElementsByClass("String_Node_Str").first();
          String amountHTML=amount.html();
          String[] amountParts=amountHTML.split("String_Node_Str",2);
          if (amountParts[0].contains("String_Node_Str") || amountParts[0].equals("String_Node_Str")) {
            value=Values.INCLUDED;
          }
 else {
            try {
              value=Double.parseDouble(amountParts[0]);
            }
 catch (            NumberFormatException e) {
              exceptionReporter.reportException(Thread.currentThread(),e,"String_Node_Str");
              value=0.0;
            }
          }
          units=amountParts[1];
        }
 catch (        NullPointerException e) {
          value=null;
          units=null;
        }
        Element details=row.getElementsByClass("String_Node_Str").first();
        String name=details.getElementsByTag("String_Node_Str").first().text();
        Element expires=details.getElementsByTag("String_Node_Str").first();
        String expiresDetails="String_Node_Str";
        if (expires != null) {
          expiresDetails=expires.text();
        }
        Log.d(TAG,expiresDetails);
        Pattern pattern;
        if (postPaid == false) {
          pattern=Pattern.compile("String_Node_Str");
        }
 else {
          pattern=Pattern.compile("String_Node_Str");
        }
        Matcher matcher=pattern.matcher(expiresDetails);
        Double expiresValue=null;
        String expiresDate=null;
        if (matcher.find()) {
          try {
            expiresValue=Double.parseDouble(matcher.group(1));
          }
 catch (          NumberFormatException e) {
            expiresValue=null;
          }
          String expiresDateString=matcher.group(2);
          Date expiresDateObj;
          if (expiresDateString != null) {
            if (expiresDateString.length() > 0) {
              try {
                expiresDateObj=DateFormatters.EXPIRESDATE.parse(expiresDateString);
                expiresDate=DateFormatters.ISO8601DATEONLYFORMAT.format(expiresDateObj);
              }
 catch (              java.text.ParseException e) {
                Log.d(TAG,"String_Node_Str" + expiresDateString);
              }
            }
          }
        }
        ContentValues values=new ContentValues();
        values.put("String_Node_Str",name);
        values.put("String_Node_Str",value);
        values.put("String_Node_Str",units);
        values.put("String_Node_Str",expiresValue);
        values.put("String_Node_Str",expiresDate);
        db.insert("String_Node_Str","String_Node_Str",values);
      }
      if (postPaid == false) {
        Log.d(TAG,"String_Node_Str");
        HttpGetter valuePacksPageGet=new HttpGetter("String_Node_Str");
        String valuePacksPageString=valuePacksPageGet.execute();
        if (valuePacksPageString != null) {
          Document valuePacksPage=Jsoup.parse(valuePacksPageString);
          Elements enabledPacks=valuePacksPage.getElementsByClass("String_Node_Str");
          for (          Element enabledPack : enabledPacks) {
            Element offerNameElemt=enabledPack.getElementsByAttributeValueStarting("String_Node_Str","String_Node_Str").first();
            if (offerNameElemt != null) {
              String offerName=offerNameElemt.val();
              DBLog.insertMessage(context,"String_Node_Str","String_Node_Str","String_Node_Str" + offerName);
              ValuePack[] packs=Values.valuePacks.get(offerName);
              if (packs == null) {
                DBLog.insertMessage(context,"String_Node_Str","String_Node_Str","String_Node_Str" + offerName + "String_Node_Str");
              }
 else {
                for (                ValuePack pack : packs) {
                  ContentValues values=new ContentValues();
                  values.put("String_Node_Str",pack.value);
                  values.put("String_Node_Str",offerName);
                  DBLog.insertMessage(context,"String_Node_Str","String_Node_Str","String_Node_Str" + pack.type.id + "String_Node_Str"+ pack.value);
                  db.update("String_Node_Str",values,"String_Node_Str" + pack.type.id + "String_Node_Str",null);
                }
              }
            }
          }
        }
      }
      SharedPreferences.Editor prefedit=sp.edit();
      Date now=new Date();
      prefedit.putString("String_Node_Str",DateFormatters.ISO8601FORMAT.format(now));
      prefedit.putBoolean("String_Node_Str",false);
      prefedit.putBoolean("String_Node_Str",false);
      prefedit.commit();
      DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str");
      return FetchResult.SUCCESS;
    }
  }
 catch (  ClientProtocolException e) {
    DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str" + e.getMessage());
    return FetchResult.NETWORKERROR;
  }
catch (  IOException e) {
    DBLog.insertMessage(context,"String_Node_Str",TAG,"String_Node_Str" + e.getMessage());
    return FetchResult.NETWORKERROR;
  }
 finally {
    db.close();
  }
  return null;
}