Fix NullPointerException when creating mini load in LoadManager (#1565)

The catch statement cancel the load job in the function named createMiniLoad.
But sometimes, the load job hasn't been created in catch statement. It will throw the NullPointerException when the load job is cancelled.
This commit fix this bug.
This commit is contained in:
EmmyMiao87
2019-07-30 12:52:14 +08:00
committed by Mingyu Chen
parent e0d991f4dc
commit 8bc8fcffae

View File

@ -149,7 +149,9 @@ public class LoadManager implements Writable{
.stream().filter(entity -> entity.getState() != JobState.CANCELLED).findFirst()
.get().getTransactionId();
} catch (UserException e) {
loadJob.cancelJobWithoutCheck(new FailMsg(LOAD_RUN_FAIL, e.getMessage()), false);
if (loadJob != null) {
loadJob.cancelJobWithoutCheck(new FailMsg(LOAD_RUN_FAIL, e.getMessage()), false);
}
throw e;
} finally {
writeUnlock();