Program: 16799
Project: 16799
Buggy source:
/** 
 * Parses a stream containing XML into an InputDefinition.
 * @param stream The stream containing XML to parse.
 * @return An {@code 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;
}

Fixed version (ground truth):
/** 
 * Parses a stream containing XML into an InputDefinition.
 * @param stream The stream containing XML to parse.
 * @return An {@code 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() == Node.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;
}