Program: 51896
Project: 51896
Buggy source:
/** 
 * Serialize a single metadata field registry entry to xml
 * @param context
 * @param xmlSerializer
 * @param mdField
 * @throws SAXException
 * @throws RegistryExportException
 * @throws SQLException
 * @throws IOException 
 */
private static void saveType(Context context,XMLSerializer xmlSerializer,MetadataField mdField) throws SAXException, RegistryExportException, SQLException, IOException {
  if (mdField == null) {
    throw new RegistryExportException("String_Node_Str");
  }
  String schemaName=getSchemaName(context,mdField);
  String element=mdField.getElement();
  String qualifier=mdField.getQualifier();
  String scopeNote=mdField.getScopeNote();
  if (schemaName == null || element == null) {
    throw new RegistryExportException("String_Node_Str");
  }
  xmlSerializer.startElement("String_Node_Str",null);
  xmlSerializer.startElement("String_Node_Str",null);
  xmlSerializer.characters(schemaName.toCharArray(),0,schemaName.length());
  xmlSerializer.endElement("String_Node_Str");
  xmlSerializer.startElement("String_Node_Str",null);
  xmlSerializer.characters(element.toCharArray(),0,element.length());
  xmlSerializer.endElement("String_Node_Str");
  if (qualifier != null) {
    xmlSerializer.startElement("String_Node_Str",null);
    xmlSerializer.characters(qualifier.toCharArray(),0,qualifier.length());
    xmlSerializer.endElement("String_Node_Str");
  }
 else {
    xmlSerializer.comment("String_Node_Str");
  }
  if (scopeNote != null) {
    xmlSerializer.startElement("String_Node_Str",null);
    xmlSerializer.characters(scopeNote.toCharArray(),0,scopeNote.length());
    xmlSerializer.endElement("String_Node_Str");
  }
 else {
    xmlSerializer.comment("String_Node_Str");
  }
  xmlSerializer.endElement("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Serialize a single metadata field registry entry to xml
 * @param context DSpace context
 * @param xmlSerializer xml serializer
 * @param mdField DSpace metadata field
 * @throws SAXException if XML error
 * @throws RegistryExportException if export error
 * @throws SQLException if database error
 * @throws IOException if IO error
 */
private static void saveType(Context context,XMLSerializer xmlSerializer,MetadataField mdField) throws SAXException, RegistryExportException, SQLException, IOException {
  if (mdField == null) {
    throw new RegistryExportException("String_Node_Str");
  }
  String schemaName=getSchemaName(context,mdField);
  String element=mdField.getElement();
  String qualifier=mdField.getQualifier();
  String scopeNote=mdField.getScopeNote();
  if (schemaName == null || element == null) {
    throw new RegistryExportException("String_Node_Str");
  }
  xmlSerializer.startElement("String_Node_Str",null);
  xmlSerializer.startElement("String_Node_Str",null);
  xmlSerializer.characters(schemaName.toCharArray(),0,schemaName.length());
  xmlSerializer.endElement("String_Node_Str");
  xmlSerializer.startElement("String_Node_Str",null);
  xmlSerializer.characters(element.toCharArray(),0,element.length());
  xmlSerializer.endElement("String_Node_Str");
  if (qualifier != null) {
    xmlSerializer.startElement("String_Node_Str",null);
    xmlSerializer.characters(qualifier.toCharArray(),0,qualifier.length());
    xmlSerializer.endElement("String_Node_Str");
  }
 else {
    xmlSerializer.comment("String_Node_Str");
  }
  if (scopeNote != null) {
    xmlSerializer.startElement("String_Node_Str",null);
    xmlSerializer.characters(scopeNote.toCharArray(),0,scopeNote.length());
    xmlSerializer.endElement("String_Node_Str");
  }
 else {
    xmlSerializer.comment("String_Node_Str");
  }
  xmlSerializer.endElement("String_Node_Str");
}