Program: 52180
Project: 52180
Buggy source:
/** 
 * Emit XML describing a single Group.
 * @param context the DSpace Context
 * @parm relatedObjectthe DSpaceObject related to this group (if any)
 * @param group the Group to describe
 * @param write the description to this stream
 */
private void writeGroup(Context context,DSpaceObject relatedObject,Group group,XMLStreamWriter writer) throws XMLStreamException, PackageException {
  writer.writeStartElement(GROUP);
  writer.writeAttribute(ID,String.valueOf(group.getID()));
  writer.writeAttribute(NAME,PackageUtils.translateGroupNameForExport(context,group.getName()));
  String groupType=getGroupType(relatedObject,group);
  if (groupType != null && !groupType.isEmpty()) {
    writer.writeAttribute(TYPE,groupType);
  }
  if (group.getMembers().length > 0) {
    writer.writeStartElement(MEMBERS);
    for (    EPerson member : group.getMembers()) {
      writer.writeEmptyElement(MEMBER);
      writer.writeAttribute(ID,String.valueOf(member.getID()));
      writer.writeAttribute(NAME,member.getName());
    }
    writer.writeEndElement();
  }
  if (group.getMemberGroups().length > 0) {
    writer.writeStartElement(MEMBER_GROUPS);
    for (    Group member : group.getMemberGroups()) {
      writer.writeEmptyElement(MEMBER_GROUP);
      writer.writeAttribute(ID,String.valueOf(member.getID()));
      writer.writeAttribute(NAME,PackageUtils.translateGroupNameForExport(context,member.getName()));
    }
    writer.writeEndElement();
  }
  writer.writeEndElement();
}

Fixed version (ground truth):
/** 
 * Emit XML describing a single Group.
 * @param context the DSpace Context
 * @parm relatedObjectthe DSpaceObject related to this group (if any)
 * @param group the Group to describe
 * @param write the description to this stream
 */
private void writeGroup(Context context,DSpaceObject relatedObject,Group group,XMLStreamWriter writer) throws XMLStreamException, PackageException {
  String exportGroupName=PackageUtils.translateGroupNameForExport(context,group.getName());
  if (exportGroupName == null)   return;
  writer.writeStartElement(GROUP);
  writer.writeAttribute(ID,String.valueOf(group.getID()));
  writer.writeAttribute(NAME,exportGroupName);
  String groupType=getGroupType(relatedObject,group);
  if (groupType != null && !groupType.isEmpty()) {
    writer.writeAttribute(TYPE,groupType);
  }
  if (group.getMembers().length > 0) {
    writer.writeStartElement(MEMBERS);
    for (    EPerson member : group.getMembers()) {
      writer.writeEmptyElement(MEMBER);
      writer.writeAttribute(ID,String.valueOf(member.getID()));
      writer.writeAttribute(NAME,member.getName());
    }
    writer.writeEndElement();
  }
  if (group.getMemberGroups().length > 0) {
    writer.writeStartElement(MEMBER_GROUPS);
    for (    Group member : group.getMemberGroups()) {
      String exportMemberName=PackageUtils.translateGroupNameForExport(context,member.getName());
      if (exportMemberName != null) {
        writer.writeEmptyElement(MEMBER_GROUP);
        writer.writeAttribute(ID,String.valueOf(member.getID()));
        writer.writeAttribute(NAME,PackageUtils.translateGroupNameForExport(context,member.getName()));
      }
    }
    writer.writeEndElement();
  }
  writer.writeEndElement();
}