Program: 45777
Project: 45777
Buggy source:
/** 
 * Loads the configuration (the set of available presets) from a URL that points to an XML configuration file.
 * @param configURL The URL of an XML configuration file
 */
protected void loadConfig(URL configURL){
  allElements.clear();
  Comparator comparator=new Comparator(){
    public int compare(    Object o1,    Object o2){
      ConfigElement c1=(ConfigElement)o1;
      ConfigElement c2=(ConfigElement)o2;
      return c1.getDescription().compareTo(c2.getDescription());
    }
  }
;
  try {
    ConfigList config=ConfigList.decode(configURL.openStream());
    allElements.put(ConfigType.GENDER,Arrays.asList((ConfigElement[])config.getGenders()));
    List<ConfigElement> headList=Arrays.asList((ConfigElement[])config.getHeads());
    Collections.sort(headList,comparator);
    allElements.put(ConfigType.HEAD,headList);
    List<ConfigElement> hairList=Arrays.asList((ConfigElement[])config.getHair());
    Collections.sort(hairList,comparator);
    allElements.put(ConfigType.HAIR,hairList);
    List<ConfigElement> torsoList=Arrays.asList((ConfigElement[])config.getTorsos());
    Collections.sort(torsoList,comparator);
    allElements.put(ConfigType.TORSO,torsoList);
    List<ConfigElement> jacketList=Arrays.asList((ConfigElement[])config.getJackets());
    Collections.sort(jacketList,comparator);
    allElements.put(ConfigType.JACKET,jacketList);
    List<ConfigElement> handsList=Arrays.asList((ConfigElement[])config.getHands());
    Collections.sort(handsList,comparator);
    allElements.put(ConfigType.HANDS,handsList);
    List<ConfigElement> legsList=Arrays.asList((ConfigElement[])config.getLegs());
    Collections.sort(legsList,comparator);
    allElements.put(ConfigType.LEGS,legsList);
    List<ConfigElement> feetList=Arrays.asList((ConfigElement[])config.getFeet());
    Collections.sort(feetList,comparator);
    allElements.put(ConfigType.FEET,feetList);
    for (    ConfigType type : ConfigType.values()) {
      List<ConfigElement> el=getElements(type);
      if (el.size() > 0) {
        setElement(type,0);
      }
    }
  }
 catch (  IOException ioe) {
    logger.log(Level.WARNING,"String_Node_Str" + configURL,ioe);
  }
}

Fixed version (ground truth):
/** 
 * Loads the configuration (the set of available presets) from a URL that points to an XML configuration file.
 * @param configURL The URL of an XML configuration file
 */
protected void loadConfig(URL configURL){
  allElements.clear();
  Comparator comparator=new Comparator(){
    public int compare(    Object o1,    Object o2){
      ConfigElement c1=(ConfigElement)o1;
      ConfigElement c2=(ConfigElement)o2;
      return c1.getDescription().compareTo(c2.getDescription());
    }
  }
;
  ConfigList config=null;
  try {
    config=ConfigList.decode(configURL.openStream());
  }
 catch (  IOException ioe) {
    logger.log(Level.WARNING,"String_Node_Str" + configURL,ioe);
    return;
  }
  allElements.put(ConfigType.GENDER,Arrays.asList((ConfigElement[])config.getGenders()));
  List<ConfigElement> headList=Arrays.asList((ConfigElement[])config.getHeads());
  Collections.sort(headList,comparator);
  allElements.put(ConfigType.HEAD,headList);
  List<ConfigElement> hairList=Arrays.asList((ConfigElement[])config.getHair());
  Collections.sort(hairList,comparator);
  allElements.put(ConfigType.HAIR,hairList);
  List<ConfigElement> torsoList=Arrays.asList((ConfigElement[])config.getTorsos());
  Collections.sort(torsoList,comparator);
  allElements.put(ConfigType.TORSO,torsoList);
  List<ConfigElement> jacketList=Arrays.asList((ConfigElement[])config.getJackets());
  Collections.sort(jacketList,comparator);
  allElements.put(ConfigType.JACKET,jacketList);
  List<ConfigElement> handsList=Arrays.asList((ConfigElement[])config.getHands());
  Collections.sort(handsList,comparator);
  allElements.put(ConfigType.HANDS,handsList);
  List<ConfigElement> legsList=Arrays.asList((ConfigElement[])config.getLegs());
  Collections.sort(legsList,comparator);
  allElements.put(ConfigType.LEGS,legsList);
  List<ConfigElement> feetList=Arrays.asList((ConfigElement[])config.getFeet());
  Collections.sort(feetList,comparator);
  allElements.put(ConfigType.FEET,feetList);
  for (  ConfigType type : ConfigType.values()) {
    List<ConfigElement> el=getElements(type);
    if (el.size() > 0) {
      setElement(type,0);
    }
  }
}