Skip to content

Commit

Permalink
Fix JENKINS-16919
Browse files Browse the repository at this point in the history
Fixed NPE by checking return of the getters for the SendFailedException.
  • Loading branch information
Alex Earl committed Feb 22, 2013
1 parent 7ae2734 commit 9f207ef
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -317,29 +317,31 @@ private boolean sendMail(EmailType mailType, AbstractBuild<?, ?> build, BuildLis
Thread.sleep(10000);
} else {
Address[] addresses = e.getValidSentAddresses();
if(addresses.length > 0) {
if(addresses != null && addresses.length > 0) {
buf = new StringBuilder("Successfully sent to the following addresses:");
for (Address a : addresses) {
buf.append(' ').append(a);
}
listener.getLogger().println(buf);
}
addresses = e.getValidUnsentAddresses();
if(addresses.length > 0) {
if(addresses != null && addresses.length > 0) {
buf = new StringBuilder("Error sending to the following VALID addresses:");
for (Address a : addresses) {
buf.append(' ').append(a);
}
listener.getLogger().println(buf);
}
addresses = e.getInvalidAddresses();
if(addresses.length > 0) {
if(addresses != null && addresses.length > 0) {
buf = new StringBuilder("Error sending to the following INVALID addresses:");
for (Address a : addresses) {
buf.append(' ').append(a);
}
listener.getLogger().println(buf);
}

debug(listener.getLogger(), "SendFailedException message: " + e.getMessage());
break;
}
}
Expand Down

0 comments on commit 9f207ef

Please sign in to comment.