Program: 109537
Project: 109537
Buggy source:
/** 
 * Decompiles .class files and nested archives in the given archive, as allowed by the given filter. <p> Nested archives will be decompiled into directories matching the name of the archive, e.g. <code>foo.ear/bar.jar/src/com/foo/bar/Baz.java</code>. <p> Required directories will be created as needed.
 * @param archive The archive containing source files and archives.
 * @param outputDir The directory where decompiled .java files will be placed.
 * @param filter Decides which classes will be decompiled.
 * @returns Result with all decompilation failures. Never throws.
 */
public DecompilationResult decompileArchive(final File archive,File outputDir,Filter<ZipEntry> filter,final DecompilationListener listener) throws DecompilationException {
  Checks.checkFileToBeRead(archive,"String_Node_Str");
  Checks.checkDirectoryToBeFilled(outputDir,"String_Node_Str");
  log.info("String_Node_Str" + archive.getAbsolutePath() + "String_Node_Str"+ outputDir.getAbsolutePath()+ "String_Node_Str");
  JarFile jar=loadJar(archive);
  final AtomicInteger jarEntryCount=new AtomicInteger(0);
  Enumeration<JarEntry> countEnum=jar.entries();
  while (countEnum.hasMoreElements()) {
    countEnum.nextElement();
    jarEntryCount.incrementAndGet();
  }
  final DecompilerSettings settings=getDefaultSettings(outputDir);
  settings.setTypeLoader(new CompositeTypeLoader(new JarTypeLoader(jar),settings.getTypeLoader()));
  final DecompilationResult res=new DecompilationResult();
  Filter.Result filterRes=Filter.Result.ACCEPT;
  final AtomicInteger current=new AtomicInteger(0);
  final Enumeration<JarEntry> entries=jar.entries();
  Collection<Callable<File>> tasks=new ArrayList<Callable<File>>();
  final Queue<MetadataSystem> metadataSystemCache=new LinkedList<>();
  refreshMetadataCache(metadataSystemCache,settings);
  while (entries.hasMoreElements()) {
    final JarEntry entry=entries.nextElement();
    if (filter != null)     filterRes=filter.decide(entry);
    if (filterRes == Filter.Result.REJECT) {
      jarEntryCount.decrementAndGet();
      continue;
    }
    if (filterRes == Filter.Result.STOP)     break;
    final String name=entry.getName();
    if (!name.endsWith("String_Node_Str")) {
      jarEntryCount.decrementAndGet();
      continue;
    }
    final String typeName=StringUtils.removeEnd(name,"String_Node_Str");
    Callable<File> callable=new Callable<File>(){
      @Override public File call() throws Exception {
        MetadataSystem metadataSystem=null;
        try {
synchronized (metadataSystemCache) {
            if (current.incrementAndGet() % 50 == 0) {
              log.info("String_Node_Str" + current + "String_Node_Str"+ jarEntryCount);
              refreshMetadataCache(metadataSystemCache,settings);
            }
            metadataSystem=metadataSystemCache.remove();
          }
          ExecutionStatistics.get().begin("String_Node_Str");
          final DecompileExecutor t=new DecompileExecutor(metadataSystem,typeName);
          t.start();
          t.join(60000L);
          if (!t.success) {
            if (t.e == null) {
              t.cancelDecompilation();
              throw new RuntimeException("String_Node_Str",t.e);
            }
 else {
              throw new RuntimeException(t.e);
            }
          }
          File outputFile=t.outputFile;
          if (outputFile != null) {
            listener.fileDecompiled(name,outputFile.getAbsolutePath());
            res.addDecompiled(name,outputFile.getAbsolutePath());
          }
          return outputFile;
        }
 catch (        Throwable th) {
          String msg="String_Node_Str" + archive.getPath() + "String_Node_Str"+ name+ "String_Node_Str"+ th.getMessage();
          DecompilationFailure ex=new DecompilationFailure(msg,name,th);
          log.log(Level.SEVERE,msg,ex);
          res.addFailure(ex);
        }
 finally {
          if (metadataSystem != null) {
synchronized (metadataSystemCache) {
              metadataSystemCache.add(metadataSystem);
            }
          }
          ExecutionStatistics.get().end("String_Node_Str");
        }
        return null;
      }
    }
;
    tasks.add(callable);
  }
  try {
    exService.invokeAll(tasks);
  }
 catch (  InterruptedException e) {
    throw new IllegalStateException("String_Node_Str");
  }
 finally {
    listener.decompilationProcessComplete();
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Decompiles .class files and nested archives in the given archive, as allowed by the given filter. <p> Nested archives will be decompiled into directories matching the name of the archive, e.g. <code>foo.ear/bar.jar/src/com/foo/bar/Baz.java</code>. <p> Required directories will be created as needed.
 * @param archive The archive containing source files and archives.
 * @param outputDir The directory where decompiled .java files will be placed.
 * @param filter Decides which classes will be decompiled.
 * @returns Result with all decompilation failures. Never throws.
 */
public DecompilationResult decompileArchive(final File archive,File outputDir,Filter<ZipEntry> filter,final DecompilationListener listener) throws DecompilationException {
  Checks.checkFileToBeRead(archive,"String_Node_Str");
  Checks.checkDirectoryToBeFilled(outputDir,"String_Node_Str");
  log.info("String_Node_Str" + archive.getAbsolutePath() + "String_Node_Str"+ outputDir.getAbsolutePath()+ "String_Node_Str");
  JarFile jar=loadJar(archive);
  try {
    final AtomicInteger jarEntryCount=new AtomicInteger(0);
    Enumeration<JarEntry> countEnum=jar.entries();
    while (countEnum.hasMoreElements()) {
      countEnum.nextElement();
      jarEntryCount.incrementAndGet();
    }
    final DecompilerSettings settings=getDefaultSettings(outputDir);
    settings.setTypeLoader(new CompositeTypeLoader(new WindupJarTypeLoader(jar),settings.getTypeLoader()));
    final DecompilationResult res=new DecompilationResult();
    Filter.Result filterRes=Filter.Result.ACCEPT;
    final AtomicInteger current=new AtomicInteger(0);
    final Enumeration<JarEntry> entries=jar.entries();
    Collection<Callable<File>> tasks=new ArrayList<Callable<File>>();
    final Queue<MetadataSystem> metadataSystemCache=new LinkedList<>();
    refreshMetadataCache(metadataSystemCache,settings);
    while (entries.hasMoreElements()) {
      final JarEntry entry=entries.nextElement();
      if (filter != null)       filterRes=filter.decide(entry);
      if (filterRes == Filter.Result.REJECT) {
        jarEntryCount.decrementAndGet();
        continue;
      }
      if (filterRes == Filter.Result.STOP)       break;
      final String name=entry.getName();
      if (!name.endsWith("String_Node_Str")) {
        jarEntryCount.decrementAndGet();
        continue;
      }
      final String typeName=StringUtils.removeEnd(name,"String_Node_Str");
      Callable<File> callable=new Callable<File>(){
        @Override public File call() throws Exception {
          MetadataSystem metadataSystem=null;
          try {
synchronized (metadataSystemCache) {
              if (current.incrementAndGet() % 50 == 0) {
                log.info("String_Node_Str" + current + "String_Node_Str"+ jarEntryCount);
                refreshMetadataCache(metadataSystemCache,settings);
              }
              metadataSystem=metadataSystemCache.remove();
            }
            ExecutionStatistics.get().begin("String_Node_Str");
            final DecompileExecutor t=new DecompileExecutor(metadataSystem,typeName);
            t.start();
            t.join(60000L);
            if (!t.success) {
              if (t.e == null) {
                t.cancelDecompilation();
                throw new RuntimeException("String_Node_Str",t.e);
              }
 else {
                throw new RuntimeException(t.e);
              }
            }
            File outputFile=t.outputFile;
            if (outputFile != null) {
              listener.fileDecompiled(name,outputFile.getAbsolutePath());
              res.addDecompiled(name,outputFile.getAbsolutePath());
            }
            return outputFile;
          }
 catch (          Throwable th) {
            String msg="String_Node_Str" + archive.getPath() + "String_Node_Str"+ name+ "String_Node_Str"+ th.getMessage();
            DecompilationFailure ex=new DecompilationFailure(msg,name,th);
            log.log(Level.SEVERE,msg,ex);
            res.addFailure(ex);
          }
 finally {
            if (metadataSystem != null) {
synchronized (metadataSystemCache) {
                metadataSystemCache.add(metadataSystem);
              }
            }
            ExecutionStatistics.get().end("String_Node_Str");
          }
          return null;
        }
      }
;
      tasks.add(callable);
    }
    try {
      exService.invokeAll(tasks);
    }
 catch (    InterruptedException e) {
      throw new IllegalStateException("String_Node_Str");
    }
 finally {
      listener.decompilationProcessComplete();
    }
    return res;
  }
  finally {
    try {
      jar.close();
    }
 catch (    IOException e) {
      log.warning("String_Node_Str" + jar.getName());
    }
  }
}