Fix false positive when searching for user alias and email
Brought to you by:
mguessan
The following code from the getEmailAndAliasFromOptions method has a bug that manifests itself in my case:
while ((line = optionsPageReader.readLine()) != null && (line.indexOf('[') == -1 || line.indexOf('@') == -1 || line.indexOf(']') == -1) && !line.toLowerCase().contains(MAILBOX_BASE)) { }
In my case, the loop ends by the second condition only:
&& (line.indexOf('[') == -1 || line.indexOf('@') == -1 || line.indexOf(']') == -1)
Later lastIndexOf method returns -1 in the following code:
int start = line.toLowerCase().lastIndexOf(MAILBOX_BASE) + MAILBOX_BASE.length();
So the above loop should look like this:
while ((line = optionsPageReader.readLine()) != null && (line.indexOf('[') == -1 || line.indexOf('@') == -1 || line.indexOf(']') == -1 || !line.toLowerCase().contains(MAILBOX_BASE))) { }
The appropriate patch is attached.
Makes sense, patch merged.
Thanks for your feedback,