Initialize jobs in the try block.

In the case where we add new fields to a Job's InputData, we want to
make sure that initialize() is called in the try block so that if it
fails, it simply fails the job (allowing the user to retry with the new
field) instead of crashing.
This commit is contained in:
Greyson Parrelli 2018-11-17 09:56:52 -08:00
parent 3f7e9cb46f
commit a2ea115650

View File

@ -79,11 +79,11 @@ public abstract class Job extends Worker implements Serializable {
((ContextDependent)this).setContext(getApplicationContext()); ((ContextDependent)this).setContext(getApplicationContext());
} }
initialize(new SafeData(data));
boolean foregroundRunning = false; boolean foregroundRunning = false;
try { try {
initialize(new SafeData(data));
if (withinRetryLimits(data)) { if (withinRetryLimits(data)) {
if (requirementsMet(data)) { if (requirementsMet(data)) {
if (needsForegroundService(data)) { if (needsForegroundService(data)) {