Program: 57058
Project: 57058
Buggy source:
/** 
 * Make sure jQuery is loaded before jQueryUI, and that every other Javascript is loaded later.
 * @param root The current UIViewRoot
 * @param context The current FacesContext
 */
private void enforceCorrectLoadOrder(UIViewRoot root,FacesContext context){
  List<UIComponent> resources=new ArrayList<UIComponent>(root.getComponentResources(context,"String_Node_Str"));
  for (  UIComponent c : resources) {
    root.removeComponentResource(context,c);
  }
  for (  UIComponent c : resources) {
    String name=(String)c.getAttributes().get("String_Node_Str");
    if (name != null) {
      name=name.toLowerCase();
      if (name.contains("String_Node_Str") && name.endsWith("String_Node_Str") && (!name.contains("String_Node_Str"))) {
        root.addComponentResource(context,c,"String_Node_Str");
      }
    }
  }
  for (  UIComponent c : resources) {
    String name=(String)c.getAttributes().get("String_Node_Str");
    if (name != null) {
      name=name.toLowerCase();
      if (name.contains("String_Node_Str") && name.endsWith("String_Node_Str")) {
        root.addComponentResource(context,c,"String_Node_Str");
      }
    }
  }
  for (  UIComponent c : resources) {
    String name=(String)c.getAttributes().get("String_Node_Str");
    if (name != null) {
      name=name.toLowerCase();
      if (!(name.contains("String_Node_Str") && name.endsWith("String_Node_Str"))) {
        root.addComponentResource(context,c,"String_Node_Str");
      }
    }
 else     root.addComponentResource(context,c,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Make sure jQuery is loaded before jQueryUI, and that every other Javascript is loaded later. Also make sure that the BootsFaces resource files are loaded prior to other resource files, giving the developer the opportunity to overwrite a CSS or JS file.
 * @param root The current UIViewRoot
 * @param context The current FacesContext
 */
private void enforceCorrectLoadOrder(UIViewRoot root,FacesContext context){
  List<UIComponent> resources=new ArrayList<UIComponent>(root.getComponentResources(context,"String_Node_Str"));
  for (  UIComponent c : resources) {
    root.removeComponentResource(context,c);
  }
  for (  UIComponent c : resources) {
    String name=(String)c.getAttributes().get("String_Node_Str");
    if (name != null) {
      name=name.toLowerCase();
      if (name.contains("String_Node_Str") && name.endsWith("String_Node_Str") && (!name.contains("String_Node_Str"))) {
        root.addComponentResource(context,c,"String_Node_Str");
      }
    }
  }
  for (  UIComponent c : resources) {
    String name=(String)c.getAttributes().get("String_Node_Str");
    if (name != null) {
      name=name.toLowerCase();
      if (name.contains("String_Node_Str") && name.endsWith("String_Node_Str")) {
        root.addComponentResource(context,c,"String_Node_Str");
      }
    }
  }
  for (  UIComponent c : resources) {
    String library=(String)c.getAttributes().get("String_Node_Str");
    if (library != null) {
      if (library.equals("String_Node_Str"))       root.addComponentResource(context,c,"String_Node_Str");
    }
  }
  for (  UIComponent c : resources) {
    String name=(String)c.getAttributes().get("String_Node_Str");
    String library=(String)c.getAttributes().get("String_Node_Str");
    if (library != null) {
      if (library.equals("String_Node_Str"))       continue;
    }
    if (name != null) {
      name=name.toLowerCase();
      if (!(name.contains("String_Node_Str") && name.endsWith("String_Node_Str"))) {
        root.addComponentResource(context,c,"String_Node_Str");
      }
    }
 else     root.addComponentResource(context,c,"String_Node_Str");
  }
}