Issue 6280 -- SMTP Setup: ArrayIndexOutOfBoundsException: length=0; index=0

When the outgoing server settings don't require
authentication, userInfoParts.length == 0.
This commit is contained in:
Joe Steele 2014-03-20 10:56:02 -04:00
parent 95f62785fc
commit bd4b7d3664
1 changed files with 3 additions and 1 deletions

View File

@ -95,7 +95,9 @@ public class SmtpTransport extends Transport {
if (smtpUri.getUserInfo() != null) {
try {
String[] userInfoParts = smtpUri.getUserInfo().split(":");
username = URLDecoder.decode(userInfoParts[0], "UTF-8");
if (userInfoParts.length > 0) {
username = URLDecoder.decode(userInfoParts[0], "UTF-8");
}
if (userInfoParts.length > 1) {
password = URLDecoder.decode(userInfoParts[1], "UTF-8");
}