Implemented work-around to handle malformed UIDL responses (POP3).

Fixes issue 3546
This commit is contained in:
cketti 2011-07-17 14:37:21 +02:00
parent 9f581cb6f3
commit 2acd55a9ef

View file

@ -456,7 +456,22 @@ public class Pop3Store extends Store {
if (response.equals(".")) {
break;
}
String[] uidParts = response.split(" ");
/*
* Yet another work-around for buggy server software:
* Replace every occurence of multiple spaces with exactly one space. This way
* the String.split() call below will have the desired effect, i.e. split the
* response into message number and unique identifier.
*
* Example for a malformed response:
* 1 2011071307115510400ae3e9e00bmu9
*
* Note the three spaces between message number and unique identifier.
* See issue 3546
*/
String cleanedResponse = response.replaceAll(" +", " ");
String[] uidParts = cleanedResponse.split(" ");
if ((uidParts.length >= 3) && "+OK".equals(uidParts[0])) {
/*
* At least one server software places a "+OK" in