Program: 9297
Project: 9297
Buggy source:
/** 
 * Populate options in a build configuration, using the Ajde BuildOptionsAdapter. Added by AMC 01.20.2003, bugzilla #29769
 */
private static boolean configureBuildOptions(AjBuildConfig config,BuildOptionsAdapter options,IMessageHandler handler){
  LangUtil.throwIaxIfNull(options,"String_Node_Str");
  LangUtil.throwIaxIfNull(config,"String_Node_Str");
  Map optionsToSet=new HashMap();
  LangUtil.throwIaxIfNull(optionsToSet,"String_Node_Str");
  if (options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5)) {
    optionsToSet.put(CompilerOptions.OPTION_Compliance,CompilerOptions.VERSION_1_5);
    optionsToSet.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_5);
  }
 else   if (options.getSourceOnePointFourMode() || options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4)) {
    optionsToSet.put(CompilerOptions.OPTION_Compliance,CompilerOptions.VERSION_1_4);
    optionsToSet.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_4);
  }
  String enc=options.getCharacterEncoding();
  if (!LangUtil.isEmpty(enc)) {
    optionsToSet.put(CompilerOptions.OPTION_Encoding,enc);
  }
  String compliance=options.getComplianceLevel();
  if (!LangUtil.isEmpty(compliance)) {
    String version=CompilerOptions.VERSION_1_4;
    if (compliance.equals(BuildOptionsAdapter.VERSION_13)) {
      version=CompilerOptions.VERSION_1_3;
    }
    optionsToSet.put(CompilerOptions.OPTION_Compliance,version);
    optionsToSet.put(CompilerOptions.OPTION_Source,version);
  }
  String sourceLevel=options.getSourceCompatibilityLevel();
  if (!LangUtil.isEmpty(sourceLevel)) {
    String slVersion=CompilerOptions.VERSION_1_4;
    if (sourceLevel.equals(BuildOptionsAdapter.VERSION_13)) {
      slVersion=CompilerOptions.VERSION_1_3;
    }
    if (sourceLevel.equals(CompilerOptions.VERSION_1_5)) {
      optionsToSet.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_5);
    }
 else {
      String setCompliance=(String)optionsToSet.get(CompilerOptions.OPTION_Compliance);
      if (!(setCompliance.equals(CompilerOptions.VERSION_1_4) && slVersion.equals(CompilerOptions.VERSION_1_3))) {
        optionsToSet.put(CompilerOptions.OPTION_Source,slVersion);
      }
    }
  }
  Set warnings=options.getWarnings();
  if (!LangUtil.isEmpty(warnings)) {
    disableWarnings(optionsToSet);
    enableWarnings(optionsToSet,warnings);
  }
 else   if (warnings == null) {
    enableWarnings(optionsToSet,DEFAULT__AJDE_WARNINGS);
  }
  Set debugOptions=options.getDebugLevel();
  if (!LangUtil.isEmpty(debugOptions)) {
    boolean sourceLine=false;
    boolean varAttr=false;
    boolean lineNo=false;
    Iterator it=debugOptions.iterator();
    while (it.hasNext()) {
      String debug=(String)it.next();
      if (debug.equals(BuildOptionsAdapter.DEBUG_ALL)) {
        sourceLine=true;
        varAttr=true;
        lineNo=true;
      }
 else       if (debug.equals(BuildOptionsAdapter.DEBUG_LINES)) {
        lineNo=true;
      }
 else       if (debug.equals(BuildOptionsAdapter.DEBUG_SOURCE)) {
        sourceLine=true;
      }
 else       if (debug.equals(BuildOptionsAdapter.DEBUG_VARS)) {
        varAttr=true;
      }
    }
    if (sourceLine)     optionsToSet.put(CompilerOptions.OPTION_SourceFileAttribute,CompilerOptions.GENERATE);
    if (varAttr)     optionsToSet.put(CompilerOptions.OPTION_LocalVariableAttribute,CompilerOptions.GENERATE);
    if (lineNo)     optionsToSet.put(CompilerOptions.OPTION_LineNumberAttribute,CompilerOptions.GENERATE);
  }
  if (options.getPreserveAllLocals()) {
    optionsToSet.put(CompilerOptions.OPTION_PreserveUnusedLocal,CompilerOptions.PRESERVE);
  }
  if (!config.isIncrementalMode() && options.getIncrementalMode()) {
    config.setIncrementalMode(true);
  }
  Map jom=options.getJavaOptionsMap();
  if (jom != null) {
    String version=(String)jom.get(CompilerOptions.OPTION_Compliance);
    if (version != null && version.equals(CompilerOptions.VERSION_1_5)) {
      config.setBehaveInJava5Way(true);
    }
  }
  config.getOptions().set(optionsToSet);
  String toAdd=options.getNonStandardOptions();
  return LangUtil.isEmpty(toAdd) ? true : configureNonStandardOptions(config,toAdd,handler);
}

Fixed version (ground truth):
/** 
 * Populate options in a build configuration, using the Ajde BuildOptionsAdapter. Added by AMC 01.20.2003, bugzilla #29769
 */
private static boolean configureBuildOptions(AjBuildConfig config,BuildOptionsAdapter options,IMessageHandler handler){
  LangUtil.throwIaxIfNull(options,"String_Node_Str");
  LangUtil.throwIaxIfNull(config,"String_Node_Str");
  Map optionsToSet=new HashMap();
  LangUtil.throwIaxIfNull(optionsToSet,"String_Node_Str");
  if (options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5)) {
    optionsToSet.put(CompilerOptions.OPTION_Compliance,CompilerOptions.VERSION_1_5);
    optionsToSet.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_5);
  }
 else   if (options.getSourceOnePointFourMode() || options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4)) {
    optionsToSet.put(CompilerOptions.OPTION_Compliance,CompilerOptions.VERSION_1_4);
    optionsToSet.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_4);
  }
  String enc=options.getCharacterEncoding();
  if (!LangUtil.isEmpty(enc)) {
    optionsToSet.put(CompilerOptions.OPTION_Encoding,enc);
  }
  String compliance=options.getComplianceLevel();
  if (!LangUtil.isEmpty(compliance)) {
    String version=CompilerOptions.VERSION_1_4;
    if (compliance.equals(BuildOptionsAdapter.VERSION_13)) {
      version=CompilerOptions.VERSION_1_3;
    }
    optionsToSet.put(CompilerOptions.OPTION_Compliance,version);
    optionsToSet.put(CompilerOptions.OPTION_Source,version);
  }
  String sourceLevel=options.getSourceCompatibilityLevel();
  if (!LangUtil.isEmpty(sourceLevel)) {
    String slVersion=CompilerOptions.VERSION_1_4;
    if (sourceLevel.equals(BuildOptionsAdapter.VERSION_13)) {
      slVersion=CompilerOptions.VERSION_1_3;
    }
    if (sourceLevel.equals(CompilerOptions.VERSION_1_5)) {
      optionsToSet.put(CompilerOptions.OPTION_Source,CompilerOptions.VERSION_1_5);
    }
 else {
      if (optionsToSet.containsKey(CompilerOptions.OPTION_Compliance)) {
        String setCompliance=(String)optionsToSet.get(CompilerOptions.OPTION_Compliance);
        if (!(setCompliance.equals(CompilerOptions.VERSION_1_4) && slVersion.equals(CompilerOptions.VERSION_1_3))) {
          optionsToSet.put(CompilerOptions.OPTION_Source,slVersion);
        }
      }
    }
  }
  Set warnings=options.getWarnings();
  if (!LangUtil.isEmpty(warnings)) {
    disableWarnings(optionsToSet);
    enableWarnings(optionsToSet,warnings);
  }
 else   if (warnings == null) {
    enableWarnings(optionsToSet,DEFAULT__AJDE_WARNINGS);
  }
  Set debugOptions=options.getDebugLevel();
  if (!LangUtil.isEmpty(debugOptions)) {
    boolean sourceLine=false;
    boolean varAttr=false;
    boolean lineNo=false;
    Iterator it=debugOptions.iterator();
    while (it.hasNext()) {
      String debug=(String)it.next();
      if (debug.equals(BuildOptionsAdapter.DEBUG_ALL)) {
        sourceLine=true;
        varAttr=true;
        lineNo=true;
      }
 else       if (debug.equals(BuildOptionsAdapter.DEBUG_LINES)) {
        lineNo=true;
      }
 else       if (debug.equals(BuildOptionsAdapter.DEBUG_SOURCE)) {
        sourceLine=true;
      }
 else       if (debug.equals(BuildOptionsAdapter.DEBUG_VARS)) {
        varAttr=true;
      }
    }
    if (sourceLine)     optionsToSet.put(CompilerOptions.OPTION_SourceFileAttribute,CompilerOptions.GENERATE);
    if (varAttr)     optionsToSet.put(CompilerOptions.OPTION_LocalVariableAttribute,CompilerOptions.GENERATE);
    if (lineNo)     optionsToSet.put(CompilerOptions.OPTION_LineNumberAttribute,CompilerOptions.GENERATE);
  }
  if (options.getPreserveAllLocals()) {
    optionsToSet.put(CompilerOptions.OPTION_PreserveUnusedLocal,CompilerOptions.PRESERVE);
  }
  if (!config.isIncrementalMode() && options.getIncrementalMode()) {
    config.setIncrementalMode(true);
  }
  Map jom=options.getJavaOptionsMap();
  if (jom != null) {
    String version=(String)jom.get(CompilerOptions.OPTION_Compliance);
    if (version != null && version.equals(CompilerOptions.VERSION_1_5)) {
      config.setBehaveInJava5Way(true);
    }
  }
  config.getOptions().set(optionsToSet);
  String toAdd=options.getNonStandardOptions();
  return LangUtil.isEmpty(toAdd) ? true : configureNonStandardOptions(config,toAdd,handler);
}