Program: 52945
Project: 52945
Buggy source:
private void updateAndStoreManifest(BuildRule rule,RuleKey key,ImmutableSet<SourcePath> inputs,RuleKeyAndInputs manifestKey,ArtifactCache cache) throws IOException {
  Preconditions.checkState(useManifestCaching(rule));
  final Path manifestPath=getManifestPath(rule);
  Manifest manifest=new Manifest();
  if (rule.getProjectFilesystem().exists(manifestPath)) {
    try (InputStream inputStream=rule.getProjectFilesystem().newFileInputStream(manifestPath)){
      manifest=new Manifest(inputStream);
    }
   }
 else {
    rule.getProjectFilesystem().createParentDirs(manifestPath);
  }
  if (manifest.size() >= maxDepFileCacheEntries) {
    manifest=new Manifest();
  }
  manifest.addEntry(fileHashCache,key,pathResolver,manifestKey.getInputs(),inputs);
  try (OutputStream outputStream=rule.getProjectFilesystem().newFileOutputStream(manifestPath)){
    manifest.serialize(outputStream);
  }
   final Path tempFile=Files.createTempFile("String_Node_Str","String_Node_Str");
  try (InputStream inputStream=rule.getProjectFilesystem().newFileInputStream(manifestPath);OutputStream outputStream=new GZIPOutputStream(new BufferedOutputStream(Files.newOutputStream(tempFile)))){
    ByteStreams.copy(inputStream,outputStream);
  }
   cache.store(ArtifactInfo.builder().addRuleKeys(manifestKey.getRuleKey()).build(),BorrowablePath.borrowablePath(tempFile)).addListener(() -> {
    try {
      Files.deleteIfExists(tempFile);
    }
 catch (    IOException e) {
      LOG.warn(e,"String_Node_Str",manifestPath);
    }
  }
,MoreExecutors.directExecutor());
}

Fixed version (ground truth):
private void updateAndStoreManifest(BuildRule rule,RuleKey key,ImmutableSet<SourcePath> inputs,RuleKeyAndInputs manifestKey,ArtifactCache cache) throws IOException {
  Preconditions.checkState(useManifestCaching(rule));
  final Path manifestPath=getManifestPath(rule);
  Manifest manifest=new Manifest(manifestKey.getRuleKey());
  if (rule.getProjectFilesystem().exists(manifestPath)) {
    try (InputStream inputStream=rule.getProjectFilesystem().newFileInputStream(manifestPath)){
      Manifest existingManifest=new Manifest(inputStream);
      if (existingManifest.getKey().equals(manifestKey.getRuleKey())) {
        manifest=existingManifest;
      }
    }
   }
 else {
    rule.getProjectFilesystem().createParentDirs(manifestPath);
  }
  if (manifest.size() >= maxDepFileCacheEntries) {
    manifest=new Manifest(manifestKey.getRuleKey());
  }
  manifest.addEntry(fileHashCache,key,pathResolver,manifestKey.getInputs(),inputs);
  try (OutputStream outputStream=rule.getProjectFilesystem().newFileOutputStream(manifestPath)){
    manifest.serialize(outputStream);
  }
   final Path tempFile=Files.createTempFile("String_Node_Str","String_Node_Str");
  try (InputStream inputStream=rule.getProjectFilesystem().newFileInputStream(manifestPath);OutputStream outputStream=new GZIPOutputStream(new BufferedOutputStream(Files.newOutputStream(tempFile)))){
    ByteStreams.copy(inputStream,outputStream);
  }
   cache.store(ArtifactInfo.builder().addRuleKeys(manifestKey.getRuleKey()).build(),BorrowablePath.borrowablePath(tempFile)).addListener(() -> {
    try {
      Files.deleteIfExists(tempFile);
    }
 catch (    IOException e) {
      LOG.warn(e,"String_Node_Str",manifestPath);
    }
  }
,MoreExecutors.directExecutor());
}