Program: 54410
Project: 54410
Buggy source:
/** 
 * Compiles a particular permutation, based on a precompiled unified AST.
 * @param logger the logger to use
 * @param unifiedAst the result of a{@link #precompile(TreeLogger,WebModeCompilerFrontEnd,String[],JJSOptions,boolean)}
 * @param permutation the permutation to compile
 * @return the output JavaScript
 * @throws UnableToCompleteException if an error other than{@link OutOfMemoryError} occurs
 */
public static PermutationResult compilePermutation(TreeLogger logger,UnifiedAst unifiedAst,Permutation permutation) throws UnableToCompleteException {
  PropertyOracle[] propertyOracles=permutation.getPropertyOracles();
  int permutationId=permutation.getId();
  Map<String,String> rebindAnswers=permutation.getRebindAnswers();
  int printId=permutationId + 1;
  logger.log(TreeLogger.INFO,"String_Node_Str" + printId + "String_Node_Str");
  long permStart=System.currentTimeMillis();
  try {
    if (JProgram.isTracingEnabled()) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
    }
    AST ast=unifiedAst.getFreshAst();
    JProgram jprogram=ast.getJProgram();
    JsProgram jsProgram=ast.getJsProgram();
    JJSOptions options=unifiedAst.getOptions();
    Map<StandardSymbolData,JsName> symbolTable=new TreeMap<StandardSymbolData,JsName>(new SymbolData.ClassIdentComparator());
    ResolveRebinds.exec(jprogram,rebindAnswers);
    if (options.isDraftCompile()) {
      draftOptimize(jprogram);
    }
 else {
      optimize(options,jprogram);
    }
    LongCastNormalizer.exec(jprogram);
    JsoDevirtualizer.exec(jprogram);
    CatchBlockNormalizer.exec(jprogram);
    PostOptimizationCompoundAssignmentNormalizer.exec(jprogram);
    LongEmulationNormalizer.exec(jprogram);
    CastNormalizer.exec(jprogram,options.isCastCheckingDisabled());
    ArrayNormalizer.exec(jprogram);
    EqualityNormalizer.exec(jprogram);
    Pruner.exec(jprogram,false);
    jprogram.typeOracle.recomputeAfterOptimizations();
    JavaToJavaScriptMap map=GenerateJavaScriptAST.exec(jprogram,jsProgram,options.getOutput(),symbolTable);
    JsNormalizer.exec(jsProgram);
    JsSymbolResolver.exec(jsProgram);
    EvalFunctionsAtTopScope.exec(jsProgram);
    if (options.isAggressivelyOptimize()) {
      boolean didChange;
      do {
        if (Thread.interrupted()) {
          throw new InterruptedException();
        }
        didChange=false;
        didChange=JsStaticEval.exec(jsProgram) || didChange;
        didChange=JsInliner.exec(jsProgram) || didChange;
        didChange=JsUnusedFunctionRemover.exec(jsProgram) || didChange;
      }
 while (didChange);
    }
    JsStackEmulator.exec(jsProgram,propertyOracles);
    SyntheticArtifact dependencies=null;
    if (options.isAggressivelyOptimize() && options.isRunAsyncEnabled()) {
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      CodeSplitter.exec(logger,jprogram,jsProgram,map,chooseDependencyRecorder(options.isSoycEnabled(),baos));
      if (baos.size() == 0 && options.isSoycEnabled()) {
        recordNonSplitDependencies(jprogram,baos);
      }
      if (baos.size() > 0) {
        dependencies=new SyntheticArtifact(SoycReportLinker.class,"String_Node_Str" + permutationId + "String_Node_Str",baos.toByteArray());
      }
    }
    Map<JsName,String> obfuscateMap=Maps.create();
switch (options.getOutput()) {
case OBFUSCATED:
      obfuscateMap=JsStringInterner.exec(jprogram,jsProgram);
    JsObfuscateNamer.exec(jsProgram);
  break;
case PRETTY:
JsPrettyNamer.exec(jsProgram);
break;
case DETAILED:
obfuscateMap=JsStringInterner.exec(jprogram,jsProgram);
JsVerboseNamer.exec(jsProgram);
break;
default :
throw new InternalCompilerException("String_Node_Str");
}
SelectionProperty userAgentProperty=null;
for (PropertyOracle oracle : propertyOracles) {
userAgentProperty=oracle.getSelectionProperty(logger,"String_Node_Str");
if (userAgentProperty != null) {
break;
}
}
boolean splitBlocks=userAgentProperty == null || ("String_Node_Str".equals(userAgentProperty.getCurrentValue()));
if (splitBlocks) {
JsIEBlockSizeVisitor.exec(jsProgram);
}
JsBreakUpLargeVarStatements.exec(jsProgram,propertyOracles);
String[] js=new String[jsProgram.getFragmentCount()];
StatementRanges[] ranges=new StatementRanges[js.length];
SizeBreakdown[] sizeBreakdowns=options.isSoycEnabled() ? new SizeBreakdown[js.length] : null;
List<Map<Range,SourceInfo>> sourceInfoMaps=options.isSoycExtra() ? new ArrayList<Map<Range,SourceInfo>>() : null;
generateJavaScriptCode(options,jsProgram,map,js,ranges,sizeBreakdowns,sourceInfoMaps,splitBlocks);
PermutationResult toReturn=new PermutationResultImpl(js,permutation,makeSymbolMap(symbolTable),ranges);
toReturn.addArtifacts(makeSoycArtifacts(logger,permutationId,jprogram,js,sizeBreakdowns,sourceInfoMaps,dependencies,map,obfuscateMap));
logger.log(TreeLogger.TRACE,"String_Node_Str" + (System.currentTimeMillis() - permStart) + "String_Node_Str");
return toReturn;
}
 catch (Throwable e) {
throw logAndTranslateException(logger,e);
}
}

Fixed version (ground truth):
/** 
 * Compiles a particular permutation, based on a precompiled unified AST.
 * @param logger the logger to use
 * @param unifiedAst the result of a{@link #precompile(TreeLogger,WebModeCompilerFrontEnd,String[],JJSOptions,boolean)}
 * @param permutation the permutation to compile
 * @return the output JavaScript
 * @throws UnableToCompleteException if an error other than{@link OutOfMemoryError} occurs
 */
public static PermutationResult compilePermutation(TreeLogger logger,UnifiedAst unifiedAst,Permutation permutation) throws UnableToCompleteException {
  PropertyOracle[] propertyOracles=permutation.getPropertyOracles();
  int permutationId=permutation.getId();
  Map<String,String> rebindAnswers=permutation.getRebindAnswers();
  int printId=permutationId + 1;
  logger.log(TreeLogger.INFO,"String_Node_Str" + printId + "String_Node_Str");
  long permStart=System.currentTimeMillis();
  try {
    if (JProgram.isTracingEnabled()) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
    }
    AST ast=unifiedAst.getFreshAst();
    JProgram jprogram=ast.getJProgram();
    JsProgram jsProgram=ast.getJsProgram();
    JJSOptions options=unifiedAst.getOptions();
    Map<StandardSymbolData,JsName> symbolTable=new TreeMap<StandardSymbolData,JsName>(new SymbolData.ClassIdentComparator());
    ResolveRebinds.exec(jprogram,rebindAnswers);
    if (options.isDraftCompile()) {
      draftOptimize(jprogram);
    }
 else {
      optimize(options,jprogram);
    }
    LongCastNormalizer.exec(jprogram);
    JsoDevirtualizer.exec(jprogram);
    CatchBlockNormalizer.exec(jprogram);
    PostOptimizationCompoundAssignmentNormalizer.exec(jprogram);
    LongEmulationNormalizer.exec(jprogram);
    CastNormalizer.exec(jprogram,options.isCastCheckingDisabled());
    ArrayNormalizer.exec(jprogram);
    EqualityNormalizer.exec(jprogram);
    Pruner.exec(jprogram,false);
    jprogram.typeOracle.recomputeAfterOptimizations();
    JavaToJavaScriptMap map=GenerateJavaScriptAST.exec(jprogram,jsProgram,options.getOutput(),symbolTable);
    JsNormalizer.exec(jsProgram);
    JsSymbolResolver.exec(jsProgram);
    EvalFunctionsAtTopScope.exec(jsProgram);
    if (options.isAggressivelyOptimize()) {
      boolean didChange;
      do {
        if (Thread.interrupted()) {
          throw new InterruptedException();
        }
        didChange=false;
        didChange=JsStaticEval.exec(jsProgram) || didChange;
        didChange=JsInliner.exec(jsProgram) || didChange;
        didChange=JsUnusedFunctionRemover.exec(jsProgram) || didChange;
      }
 while (didChange);
    }
    JsStackEmulator.exec(jsProgram,propertyOracles);
    SyntheticArtifact dependencies=null;
    if (options.isAggressivelyOptimize() && options.isRunAsyncEnabled()) {
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      CodeSplitter.exec(logger,jprogram,jsProgram,map,chooseDependencyRecorder(options.isSoycEnabled(),baos));
      if (baos.size() == 0 && options.isSoycEnabled()) {
        recordNonSplitDependencies(jprogram,baos);
      }
      if (baos.size() > 0) {
        dependencies=new SyntheticArtifact(SoycReportLinker.class,"String_Node_Str" + permutationId + "String_Node_Str",baos.toByteArray());
      }
    }
    Map<JsName,String> obfuscateMap=Maps.create();
switch (options.getOutput()) {
case OBFUSCATED:
      obfuscateMap=JsStringInterner.exec(jprogram,jsProgram);
    JsObfuscateNamer.exec(jsProgram);
  break;
case PRETTY:
JsPrettyNamer.exec(jsProgram);
break;
case DETAILED:
obfuscateMap=JsStringInterner.exec(jprogram,jsProgram);
JsVerboseNamer.exec(jsProgram);
break;
default :
throw new InternalCompilerException("String_Node_Str");
}
SelectionProperty userAgentProperty=null;
for (PropertyOracle oracle : propertyOracles) {
try {
userAgentProperty=oracle.getSelectionProperty(logger,"String_Node_Str");
}
 catch (BadPropertyValueException e) {
break;
}
}
boolean splitBlocks=userAgentProperty == null || ("String_Node_Str".equals(userAgentProperty.getCurrentValue()));
if (splitBlocks) {
JsIEBlockSizeVisitor.exec(jsProgram);
}
JsBreakUpLargeVarStatements.exec(jsProgram,propertyOracles);
String[] js=new String[jsProgram.getFragmentCount()];
StatementRanges[] ranges=new StatementRanges[js.length];
SizeBreakdown[] sizeBreakdowns=options.isSoycEnabled() ? new SizeBreakdown[js.length] : null;
List<Map<Range,SourceInfo>> sourceInfoMaps=options.isSoycExtra() ? new ArrayList<Map<Range,SourceInfo>>() : null;
generateJavaScriptCode(options,jsProgram,map,js,ranges,sizeBreakdowns,sourceInfoMaps,splitBlocks);
PermutationResult toReturn=new PermutationResultImpl(js,permutation,makeSymbolMap(symbolTable),ranges);
toReturn.addArtifacts(makeSoycArtifacts(logger,permutationId,jprogram,js,sizeBreakdowns,sourceInfoMaps,dependencies,map,obfuscateMap));
logger.log(TreeLogger.TRACE,"String_Node_Str" + (System.currentTimeMillis() - permStart) + "String_Node_Str");
return toReturn;
}
 catch (Throwable e) {
throw logAndTranslateException(logger,e);
}
}