Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

434: Adding a contributor without a full name gives a NPE #683

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -65,7 +65,12 @@ private Optional<EmailAddress> parseUser(String user, PullRequest pr, CensusInst
}
} else {
try {
return Optional.of(EmailAddress.parse(user));
var email = EmailAddress.parse(user);
if (email.fullName().isPresent()) {
return Optional.of(email);
} else {
return Optional.empty();
}
} catch (RuntimeException e) {
return Optional.empty();
}
@@ -74,7 +79,7 @@ private Optional<EmailAddress> parseUser(String user, PullRequest pr, CensusInst
if (contributor.fullName().isPresent()) {
return Optional.of(EmailAddress.from(contributor.fullName().get(), contributor.username() + "@openjdk.org"));
} else {
return Optional.of(EmailAddress.from(contributor.username() + "@openjdk.org"));
return Optional.empty();
}
}

@@ -227,6 +227,11 @@ void invalidContributor(TestInfo testInfo) throws IOException {
pr.addComment("/contributor add someone");
TestBotRunner.runPeriodicItems(prBot);
assertLastCommentContains(pr, "Could not parse `someone` as a valid contributor");

// No full name
pr.addComment("/contributor add some@one");
TestBotRunner.runPeriodicItems(prBot);
assertLastCommentContains(pr, "Could not parse `some@one` as a valid contributor");
}
}