Program: 57030
Project: 57030
Buggy source:
@Override public void encodeEnd(FacesContext facesContext,UIComponent component) throws IOException {
  if (!component.isRendered()) {
    return;
  }
  UIMessages uiMessages=(UIMessages)component;
  ResponseWriter writer=facesContext.getResponseWriter();
  String clientId=uiMessages.getClientId(facesContext);
  Iterator<FacesMessage> allMessages=uiMessages.isGlobalOnly() ? facesContext.getMessages(null) : facesContext.getMessages();
  Map<String,List<FacesMessage>> messages=new HashMap<String,List<FacesMessage>>();
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  while (allMessages.hasNext()) {
    FacesMessage message=allMessages.next();
    Severity severity=message.getSeverity();
    if (message.isRendered() && !uiMessages.isRedisplay()) {
      continue;
    }
    if (severity.equals(FacesMessage.SEVERITY_INFO))     messages.get("String_Node_Str").add(message);
 else     if (severity.equals(FacesMessage.SEVERITY_WARN))     messages.get("String_Node_Str").add(message);
 else     if (severity.equals(FacesMessage.SEVERITY_ERROR))     messages.get("String_Node_Str").add(message);
 else     if (severity.equals(FacesMessage.SEVERITY_FATAL))     messages.get("String_Node_Str").add(message);
  }
  writer.startElement("String_Node_Str",uiMessages);
  writer.writeAttribute("String_Node_Str",clientId,"String_Node_Str");
  for (  String severity : messages.keySet()) {
    List<FacesMessage> severityMessages=messages.get(severity);
    if (severityMessages.size() > 0) {
      encodeSeverityMessages(facesContext,uiMessages,severity,severityMessages);
    }
  }
  writer.endElement("String_Node_Str");
}

Fixed version (ground truth):
@Override public void encodeEnd(FacesContext facesContext,UIComponent component) throws IOException {
  if (!component.isRendered()) {
    return;
  }
  Messages uiMessages=(Messages)component;
  ResponseWriter writer=facesContext.getResponseWriter();
  String clientId=uiMessages.getClientId(facesContext);
  Iterator<FacesMessage> allMessages=uiMessages.isGlobalOnly() ? facesContext.getMessages(null) : facesContext.getMessages();
  Map<String,List<FacesMessage>> messages=new HashMap<String,List<FacesMessage>>();
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  messages.put("String_Node_Str",new ArrayList<FacesMessage>());
  while (allMessages.hasNext()) {
    FacesMessage message=allMessages.next();
    Severity severity=message.getSeverity();
    if (message.isRendered() && !uiMessages.isRedisplay()) {
      continue;
    }
    if (severity.equals(FacesMessage.SEVERITY_INFO))     messages.get("String_Node_Str").add(message);
 else     if (severity.equals(FacesMessage.SEVERITY_WARN))     messages.get("String_Node_Str").add(message);
 else     if (severity.equals(FacesMessage.SEVERITY_ERROR))     messages.get("String_Node_Str").add(message);
 else     if (severity.equals(FacesMessage.SEVERITY_FATAL))     messages.get("String_Node_Str").add(message);
  }
  writer.startElement("String_Node_Str",uiMessages);
  if (null != uiMessages.getDir()) {
    writer.writeAttribute("String_Node_Str",uiMessages.getDir(),"String_Node_Str");
  }
  writer.writeAttribute("String_Node_Str",clientId,"String_Node_Str");
  for (  String severity : messages.keySet()) {
    List<FacesMessage> severityMessages=messages.get(severity);
    if (severityMessages.size() > 0) {
      encodeSeverityMessages(facesContext,uiMessages,severity,severityMessages);
    }
  }
  writer.endElement("String_Node_Str");
}