This appears to only occur on a small portion of my users devices, I cannot reproduce this issue but its blowing up my Crashlytics reports.
Non-fatal Exception: java.text.ParseException: Unparseable date: "June 17, 1985 11:33:00 UTC" (at offset 0)
at java.text.DateFormat.parse(DateFormat.java:579)
at me.calebjones.spacelaunchnow.content.services.LaunchDataService.parsePreviousResult(LaunchDataService.java:548)
at me.calebjones.spacelaunchnow.content.services.LaunchDataService.getPreviousLaunches(LaunchDataService.java:243)
at me.calebjones.spacelaunchnow.content.services.LaunchDataService.onHandleIntent(LaunchDataService.java:115)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
There's multiple dates that it seems to get stuck on however they are all in the same format. Here's my code for parsing it.
SimpleDateFormat df = new SimpleDateFormat("MMMM dd, yyyy kk:mm:ss zzz");
df.toLocalizedPattern();
JSONObject response = new JSONObject(result);
JSONArray launchesArray = response.optJSONArray("launches");
for (int i = 0; i < launchesArray.length(); i++) {
try {
launch.setLaunchDate(df.parse(launchesObj.optString("net")));
} catch (ParseException e) {
launch.setLaunchDate(null);
}
}
Feel free to take a look at the source here: https://github.com/caman9119/SpaceLaunchNow/blob/master/mobile/src/main/java/me/calebjones/spacelaunchnow/content/services/LaunchDataService.java