Skip to content

Commit

Permalink
prevent ArrayIndexOutOfBoundsException, allow publishing, export #7059
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jul 17, 2020
1 parent c9ec158 commit 63f8008
Showing 1 changed file with 10 additions and 5 deletions.
Expand Up @@ -276,11 +276,16 @@ public static void writeCreatorsElement(XMLStreamWriter xmlw, DatasetVersionDTO
if ((nameType_check) && (!creatorName.replaceFirst(",", "").contains(","))) {
// creatorName=<FamilyName>, <FirstName>
String[] fullName = creatorName.split(", ");
givenName = fullName[1];
String familyName = fullName[0];

writeFullElement(xmlw, null, "givenName", null, givenName, language);
writeFullElement(xmlw, null, "familyName", null, familyName, language);
if (fullName.length == 2) {
givenName = fullName[1];
String familyName = fullName[0];

writeFullElement(xmlw, null, "givenName", null, givenName, language);
writeFullElement(xmlw, null, "familyName", null, familyName, language);
} else {
// It's possible to get here if "Smith," is entered as an author name.
logger.info("Unable to write givenName and familyName based on creatorName '" + creatorName + "'.");
}
}
} else {
String givenName = FirstNames.getInstance().getFirstName(creatorName);
Expand Down

0 comments on commit 63f8008

Please sign in to comment.