Program: 165379
Project: 165379
Buggy source:
public void run(){
  File f;
  String apk_file=null;
  String apkname=curapk.apkName;
synchronized (this) {
    localfile=new String(LOCAL_PATH + "String_Node_Str" + apkname);
  }
  try {
    f=new File(localfile);
    if (f.exists()) {
      Hasher hash=new Hasher(curapk.hashType,f);
      if (hash.match(curapk.hash)) {
        Log.d("String_Node_Str","String_Node_Str" + localfile);
synchronized (this) {
          filename=apk_file=localfile;
          progress=1;
          max=1;
          status=Status.RUNNING;
        }
      }
 else {
        Log.d("String_Node_Str","String_Node_Str" + localfile);
        f.delete();
      }
    }
    if (apk_file == null) {
      String remotefile;
      if (curapk.apkSource == null) {
        remotefile=curapk.server + "String_Node_Str" + apkname.replace("String_Node_Str","String_Node_Str");
      }
 else {
        remotefile=curapk.apkSource;
      }
      Log.d("String_Node_Str","String_Node_Str" + remotefile);
synchronized (this) {
        filename=remotefile;
        progress=0;
        max=curapk.size;
        status=Status.RUNNING;
      }
      BufferedInputStream getit=new BufferedInputStream(new URL(remotefile).openStream(),8192);
      FileOutputStream saveit=new FileOutputStream(localfile);
      BufferedOutputStream bout=new BufferedOutputStream(saveit,1024);
      byte data[]=new byte[1024];
      int totalRead=0;
      int bytesRead=getit.read(data,0,1024);
      while (bytesRead != -1) {
        if (isInterrupted()) {
          Log.d("String_Node_Str","String_Node_Str");
          break;
        }
        bout.write(data,0,bytesRead);
        totalRead+=bytesRead;
synchronized (this) {
          progress=totalRead;
        }
        bytesRead=getit.read(data,0,1024);
      }
      bout.close();
      getit.close();
      saveit.close();
      f=new File(localfile);
      if (isInterrupted()) {
        f.delete();
synchronized (this) {
          status=Status.CANCELLED;
        }
        return;
      }
      Hasher hash=new Hasher(curapk.hashType,f);
      if (hash.match(curapk.hash)) {
        apk_file=localfile;
      }
 else {
synchronized (this) {
          error=Error.CORRUPT;
          errorMessage=null;
          status=Status.ERROR;
        }
        Log.d("String_Node_Str","String_Node_Str" + hash.getHash() + "String_Node_Str"+ curapk.hash);
        f=new File(localfile);
        f.delete();
      }
    }
  }
 catch (  Exception e) {
    Log.e("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
synchronized (this) {
      error=Error.UNKNOWN;
      errorMessage=e.getMessage();
      status=Status.ERROR;
    }
    f=new File(localfile);
    f.delete();
  }
  if (apk_file != null) {
synchronized (this) {
      status=Status.DONE;
    }
    Log.d("String_Node_Str","String_Node_Str" + apk_file);
  }
}

Fixed version (ground truth):
public void run(){
  File f;
  String apk_file=null;
  String apkname=curapk.apkName;
synchronized (this) {
    localfile=new String(LOCAL_PATH + "String_Node_Str" + apkname);
  }
  try {
    f=new File(localfile);
    if (f.exists()) {
      Hasher hash=new Hasher(curapk.hashType,f);
      if (hash.match(curapk.hash)) {
        Log.d("String_Node_Str","String_Node_Str" + localfile);
synchronized (this) {
          filename=apk_file=localfile;
          progress=1;
          max=1;
          status=Status.RUNNING;
        }
      }
 else {
        Log.d("String_Node_Str","String_Node_Str" + localfile);
        f.delete();
      }
    }
    if (apk_file == null) {
      String remotefile;
      if (curapk.apkSource == null) {
        remotefile=curapk.server + "String_Node_Str" + apkname.replace("String_Node_Str","String_Node_Str");
      }
 else {
        remotefile=curapk.apkSource;
      }
      Log.d("String_Node_Str","String_Node_Str" + remotefile);
synchronized (this) {
        filename=remotefile;
        progress=0;
        max=curapk.size;
        status=Status.RUNNING;
      }
      BufferedInputStream getit=new BufferedInputStream(new URL(remotefile).openStream(),8192);
      FileOutputStream saveit=new FileOutputStream(localfile);
      BufferedOutputStream bout=new BufferedOutputStream(saveit,1024);
      byte data[]=new byte[1024];
      int totalRead=0;
      int bytesRead=getit.read(data,0,1024);
      while (bytesRead != -1) {
        if (isInterrupted()) {
          Log.d("String_Node_Str","String_Node_Str");
          break;
        }
        bout.write(data,0,bytesRead);
        totalRead+=bytesRead;
synchronized (this) {
          progress=totalRead;
        }
        bytesRead=getit.read(data,0,1024);
      }
      bout.close();
      getit.close();
      saveit.close();
      f=new File(localfile);
      if (isInterrupted()) {
        f.delete();
synchronized (this) {
          status=Status.CANCELLED;
        }
        return;
      }
      Hasher hash=new Hasher(curapk.hashType,f);
      if (hash.match(curapk.hash)) {
        apk_file=localfile;
      }
 else {
synchronized (this) {
          error=Error.CORRUPT;
          errorMessage=null;
          status=Status.ERROR;
        }
        Log.d("String_Node_Str","String_Node_Str" + hash.getHash() + "String_Node_Str"+ curapk.hash);
        f=new File(localfile);
        f.delete();
      }
    }
  }
 catch (  Exception e) {
    Log.e("String_Node_Str","String_Node_Str" + Log.getStackTraceString(e));
synchronized (this) {
      error=Error.UNKNOWN;
      errorMessage=e.toString();
      status=Status.ERROR;
    }
    f=new File(localfile);
    f.delete();
  }
  if (apk_file != null) {
synchronized (this) {
      status=Status.DONE;
    }
    Log.d("String_Node_Str","String_Node_Str" + apk_file);
  }
}