Program: 34822
Project: 34822
Buggy source:
public void packIndex(IndexPackingRequest request) throws IOException, IllegalArgumentException {
  if (request.getTargetDir() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (request.getTargetDir().exists()) {
    if (!request.getTargetDir().isDirectory()) {
      throw new IllegalArgumentException(String.format("String_Node_Str",request.getTargetDir().getAbsolutePath()));
    }
    if (!request.getTargetDir().canWrite()) {
      throw new IllegalArgumentException(String.format("String_Node_Str",request.getTargetDir().getAbsolutePath()));
    }
  }
 else {
    if (!request.getTargetDir().mkdirs()) {
      throw new IllegalArgumentException("String_Node_Str" + request.getTargetDir().getAbsolutePath());
    }
  }
  File legacyFile=new File(request.getTargetDir(),IndexingContext.INDEX_FILE_PREFIX + "String_Node_Str");
  File v1File=new File(request.getTargetDir(),IndexingContext.INDEX_FILE_PREFIX + "String_Node_Str");
  Properties info=null;
  try {
    info=readIndexProperties(request);
    if (request.isCreateIncrementalChunks()) {
      List<Integer> chunk=incrementalHandler.getIncrementalUpdates(request,info);
      if (chunk == null) {
        getLogger().debug("String_Node_Str");
        incrementalHandler.initializeProperties(info);
      }
 else       if (chunk.isEmpty()) {
        getLogger().debug("String_Node_Str");
      }
 else {
        File file=new File(request.getTargetDir(),IndexingContext.INDEX_FILE_PREFIX + "String_Node_Str" + info.getProperty(IndexingContext.INDEX_CHUNK_COUNTER)+ "String_Node_Str");
        writeIndexData(request.getContext(),chunk,file);
        if (request.isCreateChecksumFiles()) {
          FileUtils.fileWrite(new File(file.getParentFile(),file.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getSha1Digest(file));
          FileUtils.fileWrite(new File(file.getParentFile(),file.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getMd5Digest(file));
        }
      }
    }
  }
 catch (  IOException e) {
    getLogger().info("String_Node_Str");
    info=new Properties();
    incrementalHandler.initializeProperties(info);
  }
  Date timestamp=request.getContext().getTimestamp();
  if (timestamp == null) {
    timestamp=new Date(0);
  }
  if (request.getFormats().contains(IndexPackingRequest.IndexFormat.FORMAT_LEGACY)) {
    info.setProperty(IndexingContext.INDEX_LEGACY_TIMESTAMP,format(timestamp));
    writeIndexArchive(request.getContext(),legacyFile);
    if (request.isCreateChecksumFiles()) {
      FileUtils.fileWrite(new File(legacyFile.getParentFile(),legacyFile.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getSha1Digest(legacyFile));
      FileUtils.fileWrite(new File(legacyFile.getParentFile(),legacyFile.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getMd5Digest(legacyFile));
    }
  }
  if (request.getFormats().contains(IndexPackingRequest.IndexFormat.FORMAT_V1)) {
    info.setProperty(IndexingContext.INDEX_TIMESTAMP,format(timestamp));
    writeIndexData(request.getContext(),null,v1File);
    if (request.isCreateChecksumFiles()) {
      FileUtils.fileWrite(new File(v1File.getParentFile(),v1File.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getSha1Digest(v1File));
      FileUtils.fileWrite(new File(v1File.getParentFile(),v1File.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getMd5Digest(v1File));
    }
  }
  writeIndexProperties(request,info);
}

Fixed version (ground truth):
public void packIndex(IndexPackingRequest request) throws IOException, IllegalArgumentException {
  if (request.getTargetDir() == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (request.getTargetDir().exists()) {
    if (!request.getTargetDir().isDirectory()) {
      throw new IllegalArgumentException(String.format("String_Node_Str",request.getTargetDir().getAbsolutePath()));
    }
    if (!request.getTargetDir().canWrite()) {
      throw new IllegalArgumentException(String.format("String_Node_Str",request.getTargetDir().getAbsolutePath()));
    }
  }
 else {
    if (!request.getTargetDir().mkdirs()) {
      throw new IllegalArgumentException("String_Node_Str" + request.getTargetDir().getAbsolutePath());
    }
  }
  File legacyFile=new File(request.getTargetDir(),IndexingContext.INDEX_FILE_PREFIX + "String_Node_Str");
  File v1File=new File(request.getTargetDir(),IndexingContext.INDEX_FILE_PREFIX + "String_Node_Str");
  Properties info=null;
  final IndexingContext context=request.getContext();
  context.lock();
  try {
    try {
      info=readIndexProperties(request);
      if (request.isCreateIncrementalChunks()) {
        List<Integer> chunk=incrementalHandler.getIncrementalUpdates(request,info);
        if (chunk == null) {
          getLogger().debug("String_Node_Str");
          incrementalHandler.initializeProperties(info);
        }
 else         if (chunk.isEmpty()) {
          getLogger().debug("String_Node_Str");
        }
 else {
          File file=new File(request.getTargetDir(),IndexingContext.INDEX_FILE_PREFIX + "String_Node_Str" + info.getProperty(IndexingContext.INDEX_CHUNK_COUNTER)+ "String_Node_Str");
          writeIndexData(request.getContext(),chunk,file);
          if (request.isCreateChecksumFiles()) {
            FileUtils.fileWrite(new File(file.getParentFile(),file.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getSha1Digest(file));
            FileUtils.fileWrite(new File(file.getParentFile(),file.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getMd5Digest(file));
          }
        }
      }
    }
 catch (    IOException e) {
      getLogger().info("String_Node_Str");
      info=new Properties();
      incrementalHandler.initializeProperties(info);
    }
    Date timestamp=request.getContext().getTimestamp();
    if (timestamp == null) {
      timestamp=new Date(0);
    }
    if (request.getFormats().contains(IndexPackingRequest.IndexFormat.FORMAT_LEGACY)) {
      info.setProperty(IndexingContext.INDEX_LEGACY_TIMESTAMP,format(timestamp));
      writeIndexArchive(request.getContext(),legacyFile);
      if (request.isCreateChecksumFiles()) {
        FileUtils.fileWrite(new File(legacyFile.getParentFile(),legacyFile.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getSha1Digest(legacyFile));
        FileUtils.fileWrite(new File(legacyFile.getParentFile(),legacyFile.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getMd5Digest(legacyFile));
      }
    }
    if (request.getFormats().contains(IndexPackingRequest.IndexFormat.FORMAT_V1)) {
      info.setProperty(IndexingContext.INDEX_TIMESTAMP,format(timestamp));
      writeIndexData(request.getContext(),null,v1File);
      if (request.isCreateChecksumFiles()) {
        FileUtils.fileWrite(new File(v1File.getParentFile(),v1File.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getSha1Digest(v1File));
        FileUtils.fileWrite(new File(v1File.getParentFile(),v1File.getName() + "String_Node_Str").getAbsolutePath(),DigesterUtils.getMd5Digest(v1File));
      }
    }
    writeIndexProperties(request,info);
  }
  finally {
    context.unlock();
  }
}