Skip to content

Commit

Permalink
[FIXED JENKINS-13324] don't return invalid email addresses in mailres…
Browse files Browse the repository at this point in the history
…olver

it will now check that the email address matches '.+@.+' before returning it to jenkins
  • Loading branch information
Rob Petti committed Apr 17, 2012
1 parent 13f9f49 commit 1986bb1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/hudson/plugins/perforce/PerforceMailResolver.java
Expand Up @@ -26,8 +26,20 @@
public class PerforceMailResolver extends MailAddressResolver {
private static final Logger LOGGER = Logger.getLogger(PerforceMailResolver.class.getName());

@SuppressWarnings("unchecked")
public String findMailAddressFor(User u) {
String email = findPerforceMailAddressFor(u);
if (email == null){
return null;
} else if (email.matches(".+@.+")){
return email;
} else {
LOGGER.fine("Rejecting invalid email ("+ email +") retrieved from perforce.");
return null;
}
}

@SuppressWarnings("unchecked")
public String findPerforceMailAddressFor(User u) {
LOGGER.fine("Email address for " + u.getId() + " requested.");
String perforceId = u.getId();
PerforceUserProperty puprop = u.getProperty(PerforceUserProperty.class);
Expand Down

0 comments on commit 1986bb1

Please sign in to comment.