Program: 17548
Project: 17548
Buggy source:
public void DD() throws FailedExecuteCommand, IOException {
  Thread observer;
  if (isJobBackup() && (isJobRecovery() ? mDevice.isRecoveryDD() : mDevice.isKernelDD())) {
    observer=new Thread(new Runnable(){
      @Override public void run(){
        while (true) {
          try {
            final int progress=Common.safeLongToInt(tmpFile.length());
            mActivity.runOnUiThread(new Runnable(){
              @Override public void run(){
                pDialog.setProgress(progress);
              }
            }
);
            if (progress >= pDialog.getMax())             break;
          }
 catch (          IllegalArgumentException e) {
            mActivity.addError(Const.FLASH_UTIL_TAG,e,false);
            pDialog.setProgress(pDialog.getMax());
            break;
          }
        }
      }
    }
);
    observer.start();
  }
  if (isJobFlash()) {
    int customSize=getSizeOfFile(mCustomIMG);
    int partitionSize=getSizeOfFile(mPartition);
    if (partitionSize != 0) {
      if (customSize > partitionSize) {
        throw new IOException("String_Node_Str" + customSize / (1024 * 1024) + "String_Node_Str" + partitionSize / (1024 * 1024) + "String_Node_Str");
      }
    }
  }
  String Command="String_Node_Str";
  if (isJobFlash() || isJobRestore()) {
    if (mDevice.isLoki() && isJobFlash()) {
      Command=lokiPatch();
    }
 else {
      Common.copyFile(mCustomIMG,tmpFile);
      Command=Const.Busybox + "String_Node_Str" + tmpFile+ "String_Node_Str"+ mPartition+ "String_Node_Str";
      if ((isJobRecovery() ? mDevice.getRecoveryBlocksize() : mDevice.getKernelBlocksize()) > 0) {
        String bs="String_Node_Str" + (isJobRecovery() ? mDevice.getRecoveryBlocksize() : mDevice.getKernelBlocksize());
        Command+=bs;
      }
    }
  }
 else   if (isJobBackup()) {
    Command=Const.Busybox + "String_Node_Str" + mPartition+ "String_Node_Str"+ tmpFile+ "String_Node_Str";
  }
  mShell.execCommand(Command,true);
  if (isJobBackup())   placeImgBack();
}

Fixed version (ground truth):
public void DD() throws FailedExecuteCommand, IOException {
  Thread observer;
  if (isJobBackup() && (isJobRecovery() ? mDevice.isRecoveryDD() : mDevice.isKernelDD())) {
    observer=new Thread(new Runnable(){
      @Override public void run(){
        while (true) {
          try {
            final int progress=Common.safeLongToInt(tmpFile.length());
            mActivity.runOnUiThread(new Runnable(){
              @Override public void run(){
                pDialog.setProgress(progress);
              }
            }
);
            if (progress >= pDialog.getMax())             break;
          }
 catch (          IllegalArgumentException e) {
            mActivity.addError(Const.FLASH_UTIL_TAG,e,false);
            pDialog.setProgress(pDialog.getMax());
            break;
          }
        }
      }
    }
);
    observer.start();
  }
  if (isJobFlash()) {
    int customSize=getSizeOfFile(mCustomIMG);
    int partitionSize=getSizeOfFile(mPartition);
    if (partitionSize != 0) {
      if (customSize > partitionSize) {
        throw new IOException("String_Node_Str" + customSize / (1024 * 1024) + "String_Node_Str" + partitionSize / (1024 * 1024) + "String_Node_Str");
      }
    }
  }
  String Command="String_Node_Str";
  if (isJobFlash() || isJobRestore()) {
    if (mDevice.isLoki() && isJobFlash()) {
      Command=lokiPatch();
    }
 else {
      Common.copyFile(mCustomIMG,tmpFile);
      Command=Const.Busybox + "String_Node_Str" + tmpFile+ "String_Node_Str"+ mPartition+ "String_Node_Str";
      if ((isJobRecovery() ? mDevice.getRecoveryBlocksize() : mDevice.getKernelBlocksize()) > 0) {
        String bs="String_Node_Str" + (isJobRecovery() ? mDevice.getRecoveryBlocksize() : mDevice.getKernelBlocksize());
        Command+=bs;
      }
    }
  }
 else   if (isJobBackup()) {
    Command=Const.Busybox + "String_Node_Str" + mPartition+ "String_Node_Str"+ tmpFile+ "String_Node_Str";
  }
  mShell.execCommand(Command);
  if (isJobBackup())   placeImgBack();
}