I had posted a question to Stack Overflow.
If Android didn't restrict unit tests by stubbing out the entire API to return null, I would be able to reproduce this in unit tests, but alas, the unit tests pass. This also means unit tests are useless when developing for the Android platform. This in turn might explain why the quality of most applications on the platform is so "High Kwality".
Since unit tests are unusable, I'm currently at the point where I have resorted to debugging the running Android process. Which, I should add, must be the shittiest debugger experience I've ever had. The "Debug" action in the GUI doesn't work. You have to attach to the running process. The process will eventually time out and get killed by the platform due to being stalled during debugging, so you have to race to discover whatever information you can get before it gets killed by the platform.
Anyway, from the time I did manage to get the debugger to step around, here's what I'm seeing.
First, we land at SimpleDateFormat line 1088, which calls my Calendar's getDisplayName method. This method returns "Sun". So far so good.
Next we get to the PATTERN_DAY_OF_WEEK case for the switch statement on line 1151:
case PATTERN_DAY_OF_WEEK: // 'E'
{
current = formatWeekday(count, value, useDateFormatSymbols, false /* standalone */);
break;
}
formatWeekday on line 1272 is implemented like this:
private String formatWeekday(int count, int value, boolean useDateFormatSymbols,
boolean standalone) {
if (useDateFormatSymbols) {
/* do some other stuff */
}
return null;
}
useDateFormatSymbols is false, so the contents of the block are irrelevant and this method always returns null.
This in turn means that the correct result, "Sun", is immediately overwritten, so current is now null.
This means nothing gets appended to the result.
Eventually I give up trying to figure out how to fix it and file the bug.