Program: 28278
Project: 28278
Buggy source:
/** 
 * <p> This method returns any facets that should be applied to the <code>TreeNode (comp)</code>.  Useful facets for the sun <code>TreeNode</code> component are: "content" and "image".</p> <p> Facets that already exist on <code>comp</code>, or facets that are directly added to <code>comp</code> do not need to be returned from this method.</p> <p> This implementation directly adds a "content" and "image" facet and returns <code>null</code> from this method.</p>
 * @param comp	    The tree node <code>UIComponent</code>.
 * @param nodeObject  The (model) object representing the tree node.
 */
public Map<String,UIComponent> getFacets(UIComponent comp,Object nodeObject){
  if (nodeObject == null) {
    return null;
  }
  if ((nodeObject instanceof Integer) && nodeObject.equals(TOP_ID)) {
    return null;
  }
  Properties props=new Properties();
  LayoutComponent desc=this.getLayoutComponent();
  setProperty(props,"String_Node_Str",desc.getOption("String_Node_Str"));
  setProperty(props,"String_Node_Str",desc.getOption("String_Node_Str"));
  FacesContext ctx=FacesContext.getCurrentInstance();
  ComponentUtil compUtil=ComponentUtil.getInstance(ctx);
  UIComponent imageLink=compUtil.getChild(comp,"String_Node_Str","String_Node_Str",props,"String_Node_Str");
  imageLink.setRendererType("String_Node_Str");
  setProperty(props,"String_Node_Str",comp.getAttributes().get("String_Node_Str"));
  UIComponent link=compUtil.getChild(comp,"String_Node_Str","String_Node_Str",props,"String_Node_Str");
  link.setRendererType("String_Node_Str");
  Object val=desc.getOption("String_Node_Str");
  if (val != null) {
    val=desc.resolveValue(ctx,link,val);
    link.getAttributes().put("String_Node_Str",val);
    imageLink.getAttributes().put("String_Node_Str",val);
  }
  val=desc.getOption("String_Node_Str");
  if (val != null) {
    imageLink.getAttributes().put("String_Node_Str",desc.resolveValue(ctx,link,val));
  }
  List handlers=desc.getHandlers("String_Node_Str");
  if (handlers != null) {
    link.getAttributes().put("String_Node_Str",handlers);
    imageLink.getAttributes().put("String_Node_Str",handlers);
    ((ActionSource)link).addActionListener(CommandActionListener.getInstance());
    ((ActionSource)imageLink).addActionListener(CommandActionListener.getInstance());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * <p> This method returns any facets that should be applied to the <code>TreeNode (comp)</code>.  Useful facets for the sun <code>TreeNode</code> component are: "content" and "image".</p> <p> Facets that already exist on <code>comp</code>, or facets that are directly added to <code>comp</code> do not need to be returned from this method.</p> <p> This implementation directly adds a "content" and "image" facet and returns <code>null</code> from this method.</p>
 * @param comp	    The tree node <code>UIComponent</code>.
 * @param nodeObject  The (model) object representing the tree node.
 */
public Map<String,UIComponent> getFacets(UIComponent comp,Object nodeObject){
  if (nodeObject == null) {
    return null;
  }
  if ((nodeObject instanceof Integer) && nodeObject.equals(TOP_ID)) {
    return null;
  }
  Properties props=new Properties();
  LayoutComponent desc=this.getLayoutComponent();
  setProperty(props,"String_Node_Str",desc.getOption("String_Node_Str"));
  setProperty(props,"String_Node_Str",desc.getOption("String_Node_Str"));
  FacesContext ctx=FacesContext.getCurrentInstance();
  ComponentUtil compUtil=ComponentUtil.getInstance(ctx);
  UIComponent imageLink=compUtil.getChild(comp,"String_Node_Str","String_Node_Str",props,"String_Node_Str");
  imageLink.setRendererType("String_Node_Str");
  setProperty(props,"String_Node_Str",comp.getAttributes().get("String_Node_Str"));
  UIComponent link=compUtil.getChild(comp,"String_Node_Str","String_Node_Str",props,"String_Node_Str");
  link.setRendererType("String_Node_Str");
  Object val=desc.getOption("String_Node_Str");
  if (val != null) {
    val=desc.resolveValue(ctx,link,val);
    link.getAttributes().put("String_Node_Str",val);
    imageLink.getAttributes().put("String_Node_Str",val);
  }
  val=desc.getOption("String_Node_Str");
  if (val != null) {
    imageLink.getAttributes().put("String_Node_Str",desc.resolveValue(ctx,link,val));
  }
  List handlers=desc.getHandlers("String_Node_Str");
  if (handlers != null) {
    link.getAttributes().put("String_Node_Str",handlers);
    imageLink.getAttributes().put("String_Node_Str",handlers);
    (ActionSource.class.cast(link)).addActionListener(CommandActionListener.getInstance());
    (ActionSource.class.cast(imageLink)).addActionListener(CommandActionListener.getInstance());
  }
  return null;
}