Program: 57029
Project: 57029
Buggy source:
/** 
 * This methods generates the HTML code of the current b:message.
 * @param context the FacesContext.
 * @param component the current b:message.
 * @throws IOException thrown if something goes wrong when writing the HTML code.
 */
@Override public void encodeBegin(FacesContext context,UIComponent component) throws IOException {
  if (!component.isRendered()) {
    return;
  }
  Message message=(Message)component;
  String forValue=message.getFor();
  if (null == forValue || forValue.length() == 0)   forValue="String_Node_Str";
  forValue=ExpressionResolver.getComponentIDs(context,message,forValue);
  List<FacesMessage> messageList=new ArrayList<FacesMessage>();
  Iterator<FacesMessage> messageIterator=FacesContext.getCurrentInstance().getMessages(forValue);
  while (messageIterator.hasNext()) {
    FacesMessage fm=messageIterator.next();
    messageList.add(fm);
  }
  ResponseWriter rw=context.getResponseWriter();
  String clientId=message.getClientId();
  if (null != messageList && (!messageList.isEmpty())) {
    rw.startElement("String_Node_Str",message);
    writeAttribute(rw,"String_Node_Str",clientId);
    String styleClass=message.getStyleClass();
    if (null != styleClass && styleClass.length() > 0)     styleClass=styleClass + "String_Node_Str";
 else     styleClass="String_Node_Str";
    String severityClass=findHighestSeverityClass(messageList,message);
    styleClass+="String_Node_Str" + severityClass + "String_Node_Str";
    writeAttribute(rw,"String_Node_Str",styleClass);
    writeAttribute(rw,"String_Node_Str","String_Node_Str");
    for (    FacesMessage msg : messageList) {
      if (message.isShowIcon()) {
        rw.startElement("String_Node_Str",component);
        writeAttribute(rw,"String_Node_Str","String_Node_Str");
        writeAttribute(rw,"String_Node_Str","String_Node_Str");
        rw.endElement("String_Node_Str");
      }
      if (message.isShowSummary()) {
        if (msg.getSummary() != null && (!msg.getSummary().equals(msg.getDetail()))) {
          rw.startElement("String_Node_Str",component);
          writeAttribute(rw,"String_Node_Str","String_Node_Str");
          rw.writeText(msg.getSummary(),null);
          rw.endElement("String_Node_Str");
        }
      }
      if (message.isShowDetail()) {
        rw.startElement("String_Node_Str",component);
        writeAttribute(rw,"String_Node_Str","String_Node_Str");
        rw.writeText(msg.getDetail(),null);
        rw.endElement("String_Node_Str");
      }
    }
    rw.endElement("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * This methods generates the HTML code of the current b:message.
 * @param context the FacesContext.
 * @param component the current b:message.
 * @throws IOException thrown if something goes wrong when writing the HTML code.
 */
@Override public void encodeBegin(FacesContext context,UIComponent component) throws IOException {
  if (!component.isRendered()) {
    return;
  }
  Message message=(Message)component;
  String forValue=message.getFor();
  if (null == forValue || forValue.length() == 0)   forValue="String_Node_Str";
  forValue=ExpressionResolver.getComponentIDs(context,message,forValue);
  List<FacesMessage> messageList=new ArrayList<FacesMessage>();
  Iterator<FacesMessage> messageIterator=FacesContext.getCurrentInstance().getMessages(forValue);
  while (messageIterator.hasNext()) {
    FacesMessage fm=messageIterator.next();
    messageList.add(fm);
  }
  ResponseWriter rw=context.getResponseWriter();
  String clientId=message.getClientId();
  if (null != messageList && (!messageList.isEmpty())) {
    rw.startElement("String_Node_Str",message);
    writeAttribute(rw,"String_Node_Str",clientId);
    if (null != message.getDir()) {
      rw.writeAttribute("String_Node_Str",message.getDir(),"String_Node_Str");
    }
    String styleClass=message.getStyleClass();
    if (null != styleClass && styleClass.length() > 0)     styleClass=styleClass + "String_Node_Str";
 else     styleClass="String_Node_Str";
    String severityClass=findHighestSeverityClass(messageList,message);
    styleClass+="String_Node_Str" + severityClass + "String_Node_Str";
    writeAttribute(rw,"String_Node_Str",styleClass);
    writeAttribute(rw,"String_Node_Str","String_Node_Str");
    for (    FacesMessage msg : messageList) {
      if (message.isShowIcon()) {
        rw.startElement("String_Node_Str",component);
        writeAttribute(rw,"String_Node_Str","String_Node_Str");
        writeAttribute(rw,"String_Node_Str","String_Node_Str");
        rw.endElement("String_Node_Str");
      }
      if (message.isShowSummary()) {
        if (msg.getSummary() != null && (!msg.getSummary().equals(msg.getDetail()))) {
          rw.startElement("String_Node_Str",component);
          writeAttribute(rw,"String_Node_Str","String_Node_Str");
          rw.writeText(msg.getSummary(),null);
          rw.endElement("String_Node_Str");
        }
      }
      if (message.isShowDetail()) {
        rw.startElement("String_Node_Str",component);
        writeAttribute(rw,"String_Node_Str","String_Node_Str");
        rw.writeText(msg.getDetail(),null);
        rw.endElement("String_Node_Str");
      }
    }
    rw.endElement("String_Node_Str");
  }
}