Program: 16817
Project: 16817
Buggy source:
/** 
 * Parse a stream containing XML into an InputDefinition.
 * @param stream The stream containing XML to parse.
 * @return an InputDefinition object.
 * @throws ParserConfigurationException if there are errors in setting up the parser (which indicates systemconfiguration issues).
 * @throws IOException if there is an error in reading from the stream.
 * @throws SAXException when the XML is invalid.
 * @throws MalformedDataException when the XML does specify a valid set of inputs.
 */
public static InputDefinition parseDefinition(InputStream stream) throws ParserConfigurationException, IOException, SAXException, MalformedDataException {
  DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
  Document doc=documentBuilder.parse(stream);
  InputDefinition definition=new InputDefinition();
  for (Node node=doc.getDocumentElement().getFirstChild(); node != null; node=node.getNextSibling()) {
    if (node.getNodeType() == node.TEXT_NODE) {
      continue;
    }
 else     if (node.getNodeName().equals("String_Node_Str")) {
      definition.setServerHost(XmlUtil.textInNode(node,"String_Node_Str"));
    }
 else     if (node.getNodeName().equals("String_Node_Str")) {
      definition.setServerUri(XmlUtil.textInNode(node,"String_Node_Str"));
    }
 else     if (node.getNodeName().equals("String_Node_Str")) {
      definition.setCheckpointDir(XmlUtil.textInNode(node,"String_Node_Str"));
    }
 else     if (node.getNodeName().equals("String_Node_Str")) {
      definition.setSessionKey(XmlUtil.textInNode(node,"String_Node_Str"));
    }
 else     if (node.getNodeName().equals("String_Node_Str")) {
      for (Node child=node.getFirstChild(); child != null; child=child.getNextSibling()) {
        if (child.getNodeType() == child.TEXT_NODE) {
          continue;
        }
        if (!child.getNodeName().equals("String_Node_Str")) {
          throw new MalformedDataException("String_Node_Str" + child.getNodeName());
        }
        String name=child.getAttributes().getNamedItem("String_Node_Str").getNodeValue();
        List<Parameter> parameter=Parameter.nodeToParameterList(child);
        definition.addInput(name,parameter);
      }
    }
  }
  return definition;
}

Fixed version (ground truth):
/** 
 * Parse a stream containing XML into an InputDefinition.
 * @param stream The stream containing XML to parse.
 * @return an InputDefinition object.
 * @throws ParserConfigurationException if there are errors in setting up the parser (which indicates systemconfiguration issues).
 * @throws IOException if there is an error in reading from the stream.
 * @throws SAXException when the XML is invalid.
 * @throws MalformedDataException when the XML does specify a valid set of inputs.
 */
public static InputDefinition parseDefinition(InputStream stream) throws ParserConfigurationException, IOException, SAXException, MalformedDataException {
  DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
  Document doc=documentBuilder.parse(stream);
  InputDefinition definition=new InputDefinition();
  for (Node node=doc.getDocumentElement().getFirstChild(); node != null; node=node.getNextSibling()) {
    if (node.getNodeType() == node.TEXT_NODE) {
      continue;
    }
 else     if (node.getNodeName().equals("String_Node_Str")) {
      for (Node child=node.getFirstChild(); child != null; child=child.getNextSibling()) {
        if (child.getNodeType() == child.TEXT_NODE) {
          continue;
        }
        if (!child.getNodeName().equals("String_Node_Str")) {
          throw new MalformedDataException("String_Node_Str" + child.getNodeName());
        }
        String name=child.getAttributes().getNamedItem("String_Node_Str").getNodeValue();
        List<Parameter> parameter=Parameter.nodeToParameterList(child);
        definition.addInput(name,parameter);
      }
    }
 else {
      definition.metadata.put(node.getNodeName(),XmlUtil.textInNode(node,"String_Node_Str" + node.getNodeName()));
    }
  }
  return definition;
}