Program: 167819
Project: 167819
Buggy source:
protected void writeDeploymentOverlays(final XMLExtendedStreamWriter writer,final ModelNode modelNode) throws XMLStreamException {
  Set<String> names=modelNode.keys();
  if (names.size() > 0) {
    writer.writeStartElement(Element.DEPLOYMENT_OVERLAYS.getLocalName());
    for (    String uniqueName : names) {
      final ModelNode contentItem=modelNode.get(uniqueName);
      writer.writeStartElement(Element.DEPLOYMENT_OVERLAY.getLocalName());
      writeAttribute(writer,Attribute.NAME,uniqueName);
      if (contentItem.hasDefined(CONTENT)) {
        final ModelNode overridesNode=contentItem.get(CONTENT);
        final Set<String> overrides=overridesNode.keys();
        for (        final String override : overrides) {
          final ModelNode overrideNode=overridesNode.get(override);
          final String content=HashUtil.bytesToHexString(overrideNode.require(CONTENT).asBytes());
          writer.writeStartElement(Element.CONTENT.getLocalName());
          writeAttribute(writer,Attribute.PATH,override);
          writeAttribute(writer,Attribute.CONTENT,content);
          writer.writeEndElement();
        }
      }
      if (contentItem.hasDefined(DEPLOYMENT)) {
        final ModelNode deployments=contentItem.get(DEPLOYMENT);
        Set<String> deploymentNames=deployments.keys();
        if (deploymentNames.size() > 0) {
          for (          String deploymentName : deploymentNames) {
            final ModelNode depNode=deployments.get(uniqueName);
            final boolean regEx=depNode.hasDefined(REGULAR_EXPRESSION) ? depNode.get(REGULAR_EXPRESSION).asBoolean() : false;
            writer.writeStartElement(Element.DEPLOYMENT.getLocalName());
            writeAttribute(writer,Attribute.NAME,deploymentName);
            if (regEx) {
              writeAttribute(writer,Attribute.REGULAR_EXPRESSION,"String_Node_Str");
            }
            writer.writeEndElement();
          }
        }
      }
      writer.writeEndElement();
    }
    writer.writeEndElement();
    writeNewLine(writer);
  }
}

Fixed version (ground truth):
protected void writeDeploymentOverlays(final XMLExtendedStreamWriter writer,final ModelNode modelNode) throws XMLStreamException {
  Set<String> names=modelNode.keys();
  if (names.size() > 0) {
    writer.writeStartElement(Element.DEPLOYMENT_OVERLAYS.getLocalName());
    for (    String uniqueName : names) {
      final ModelNode contentItem=modelNode.get(uniqueName);
      writer.writeStartElement(Element.DEPLOYMENT_OVERLAY.getLocalName());
      writeAttribute(writer,Attribute.NAME,uniqueName);
      if (contentItem.hasDefined(CONTENT)) {
        final ModelNode overridesNode=contentItem.get(CONTENT);
        final Set<String> overrides=overridesNode.keys();
        for (        final String override : overrides) {
          final ModelNode overrideNode=overridesNode.get(override);
          final String content=HashUtil.bytesToHexString(overrideNode.require(CONTENT).asBytes());
          writer.writeStartElement(Element.CONTENT.getLocalName());
          writeAttribute(writer,Attribute.PATH,override);
          writeAttribute(writer,Attribute.CONTENT,content);
          writer.writeEndElement();
        }
      }
      if (contentItem.hasDefined(DEPLOYMENT)) {
        final ModelNode deployments=contentItem.get(DEPLOYMENT);
        Set<String> deploymentNames=deployments.keys();
        if (deploymentNames.size() > 0) {
          for (          String deploymentName : deploymentNames) {
            final ModelNode depNode=deployments.get(deploymentName);
            final boolean regEx=depNode.hasDefined(REGULAR_EXPRESSION) ? depNode.get(REGULAR_EXPRESSION).asBoolean() : false;
            writer.writeStartElement(Element.DEPLOYMENT.getLocalName());
            writeAttribute(writer,Attribute.NAME,deploymentName);
            if (regEx) {
              writeAttribute(writer,Attribute.REGULAR_EXPRESSION,"String_Node_Str");
            }
            writer.writeEndElement();
          }
        }
      }
      writer.writeEndElement();
    }
    writer.writeEndElement();
    writeNewLine(writer);
  }
}