Program: 187184
Project: 187184
Buggy source:
public void run(){
  Log.d(AppConstants.TAG,"String_Node_Str");
  String sUrlLesson=null;
  try {
    File lessonFolder=mLocalStorageRoot;
    if (mSubFolder != null)     lessonFolder=new File(mLocalStorageRoot,mSubFolder);
    lessonFolder.mkdirs();
    Log.d(AppConstants.TAG,"String_Node_Str" + lessonFolder.getAbsolutePath());
    StrongHttpsClient httpClient=getHttpClientInstance();
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mContext.getApplicationContext());
    boolean useTor=settings.getBoolean("String_Node_Str",false);
    if (useTor) {
      httpClient.useProxy(true,"String_Node_Str",AppConstants.TOR_PROXY_HOST,AppConstants.TOR_PROXY_PORT);
    }
 else {
      httpClient.useProxy(false,null,null,-1);
    }
    String urlBase=mUrlRemoteRepo;
    if (mSubFolder != null)     urlBase+=mSubFolder + '/';
    String urlIndex=urlBase + LESSON_METADATA_FILE;
    Log.d(AppConstants.TAG,"String_Node_Str" + urlIndex);
    HttpGet request=new HttpGet(urlIndex);
    HttpResponse response=httpClient.execute(request);
    HttpEntity entity=response.getEntity();
    int statusCode=response.getStatusLine().getStatusCode();
    long conLen=entity.getContentLength();
    boolean isChunked=entity.isChunked();
    if (statusCode == 200) {
      String jsonData=EntityUtils.toString(entity);
      if (!jsonData.contains("String_Node_Str"))       jsonData+="String_Node_Str";
      JSONObject jObjMain=new JSONObject(jsonData);
      JSONArray jarray=jObjMain.getJSONArray("String_Node_Str");
      for (int i=0; i < jarray.length() && (!jarray.isNull(i)); i++) {
        try {
          if (mListener != null) {
            mListener.lessonLoadingStatusMessage(String.format("String_Node_Str" + mContext.getString(R.string._of_) + "String_Node_Str",(i + 1),jarray.length()));
          }
          JSONObject jobj=jarray.getJSONObject(i);
          String title=jobj.getString("String_Node_Str");
          String lessonUrl=jobj.getJSONObject("String_Node_Str").getString("String_Node_Str");
          sUrlLesson=urlBase + lessonUrl;
          Log.d(AppConstants.TAG,"String_Node_Str" + sUrlLesson);
          URI urlLesson=new URI(sUrlLesson);
          request=new HttpGet(urlLesson);
          response=httpClient.execute(request);
          String fileName=urlLesson.getPath();
          fileName=fileName.substring(fileName.lastIndexOf('/') + 1);
          File fileZip=new File(lessonFolder,fileName);
          if (fileZip.exists()) {
            long remoteLen=response.getEntity().getContentLength();
            long localLen=fileZip.length();
            if (localLen == remoteLen) {
              Log.d(AppConstants.TAG,"String_Node_Str");
              response.getEntity().consumeContent();
              continue;
            }
 else {
              if (mListener != null)               mListener.lessonLoadingStatusMessage("String_Node_Str" + (i + 1) + "String_Node_Str"+ jarray.length()+ "String_Node_Str"+ "String_Node_Str"+ remoteLen / 1000000 + "String_Node_Str");
              Log.d(AppConstants.TAG,"String_Node_Str");
              fileZip.delete();
            }
          }
          if (mListener != null)           mListener.loadingLessonFromServer(mSubFolder,title);
          fileZip.getParentFile().mkdirs();
          BufferedInputStream bis=new BufferedInputStream(response.getEntity().getContent());
          IOUtils.copyLarge(bis,new FileOutputStream(fileZip));
          unpack(fileZip,lessonFolder);
        }
 catch (        Exception ioe) {
          Log.e(AppConstants.TAG,"String_Node_Str" + sUrlLesson,ioe);
          if (response != null)           response.getEntity().consumeContent();
          if (mListener != null)           mListener.errorLoadingLessons(ioe.getLocalizedMessage());
        }
      }
      if (mListener != null)       mListener.lessonsLoadedFromServer();
    }
 else {
      Log.w(AppConstants.TAG,"String_Node_Str" + sUrlLesson);
      if (mListener != null)       mListener.errorLoadingLessons("String_Node_Str");
    }
  }
 catch (  Exception ioe) {
    Log.e(AppConstants.TAG,"String_Node_Str" + sUrlLesson,ioe);
    if (mListener != null)     mListener.errorLoadingLessons(ioe.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void run(){
  Log.d(AppConstants.TAG,"String_Node_Str");
  String sUrlLesson=null;
  try {
    File lessonFolder=mLocalStorageRoot;
    if (mSubFolder != null)     lessonFolder=new File(mLocalStorageRoot,mSubFolder);
    lessonFolder.mkdirs();
    Log.d(AppConstants.TAG,"String_Node_Str" + lessonFolder.getAbsolutePath());
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mContext.getApplicationContext());
    boolean useDownloadManager=settings.getBoolean("String_Node_Str",true);
    StrongHttpsClient httpClient=getHttpClientInstance();
    boolean useTor=settings.getBoolean("String_Node_Str",false);
    if (useTor) {
      httpClient.useProxy(true,"String_Node_Str",AppConstants.TOR_PROXY_HOST,AppConstants.TOR_PROXY_PORT);
    }
 else {
      httpClient.useProxy(false,null,null,-1);
    }
    String urlBase=mUrlRemoteRepo;
    if (mSubFolder != null)     urlBase+=mSubFolder + '/';
    String urlIndex=urlBase + LESSON_METADATA_FILE;
    Log.d(AppConstants.TAG,"String_Node_Str" + urlIndex);
    HttpGet request=new HttpGet(urlIndex);
    HttpResponse response=httpClient.execute(request);
    HttpEntity entity=response.getEntity();
    int statusCode=response.getStatusLine().getStatusCode();
    long conLen=entity.getContentLength();
    boolean isChunked=entity.isChunked();
    if (statusCode == 200) {
      String jsonData=EntityUtils.toString(entity);
      if (!jsonData.contains("String_Node_Str"))       jsonData+="String_Node_Str";
      JSONObject jObjMain=new JSONObject(jsonData);
      JSONArray jarray=jObjMain.getJSONArray("String_Node_Str");
      for (int i=0; i < jarray.length() && (!jarray.isNull(i)); i++) {
        try {
          if (mListener != null) {
            mListener.lessonLoadingStatusMessage(String.format("String_Node_Str" + mContext.getString(R.string._of_) + "String_Node_Str",(i + 1),jarray.length()));
          }
          JSONObject jobj=jarray.getJSONObject(i);
          String title=jobj.getString("String_Node_Str");
          String lessonUrl=jobj.getJSONObject("String_Node_Str").getString("String_Node_Str");
          sUrlLesson=urlBase + lessonUrl;
          Log.d(AppConstants.TAG,"String_Node_Str" + sUrlLesson);
          if (useDownloadManager) {
            URI urlLesson=new URI(sUrlLesson);
            String fileName=urlLesson.getPath();
            fileName=fileName.substring(fileName.lastIndexOf('/') + 1);
            File fileZip=new File(lessonFolder,fileName);
            doDownloadManager(Uri.parse(sUrlLesson),title,fileName,Uri.fromFile(fileZip));
          }
 else {
            URI urlLesson=new URI(sUrlLesson);
            request=new HttpGet(urlLesson);
            response=httpClient.execute(request);
            String fileName=urlLesson.getPath();
            fileName=fileName.substring(fileName.lastIndexOf('/') + 1);
            File fileZip=new File(lessonFolder,fileName);
            long remoteLen=response.getEntity().getContentLength();
            if (fileZip.exists()) {
              long localLen=fileZip.length();
              if (localLen == remoteLen) {
                Log.d(AppConstants.TAG,"String_Node_Str");
                response.getEntity().consumeContent();
                continue;
              }
 else {
                Log.d(AppConstants.TAG,"String_Node_Str");
                fileZip.delete();
              }
            }
            if (mListener != null)             mListener.lessonLoadingStatusMessage("String_Node_Str" + (i + 1) + "String_Node_Str"+ jarray.length()+ "String_Node_Str"+ "String_Node_Str"+ remoteLen / 1000000 + "String_Node_Str");
            fileZip.getParentFile().mkdirs();
            BufferedInputStream bis=new BufferedInputStream(response.getEntity().getContent());
            IOUtils.copy(bis,new FileOutputStream(fileZip));
            unpack(fileZip,lessonFolder);
            fileZip.delete();
          }
        }
 catch (        Exception ioe) {
          Log.e(AppConstants.TAG,"String_Node_Str" + sUrlLesson,ioe);
          if (response != null)           response.getEntity().consumeContent();
          if (mListener != null)           mListener.errorLoadingLessons(ioe.getLocalizedMessage());
        }
      }
      if (mListener != null)       mListener.lessonsLoadedFromServer();
    }
 else {
      Log.w(AppConstants.TAG,"String_Node_Str" + sUrlLesson);
      if (mListener != null)       mListener.errorLoadingLessons("String_Node_Str");
    }
  }
 catch (  Exception ioe) {
    Log.e(AppConstants.TAG,"String_Node_Str" + sUrlLesson,ioe);
    if (mListener != null)     mListener.errorLoadingLessons(ioe.getLocalizedMessage());
  }
}