Skip to content

Commit

Permalink
Fix NullPointerException when creating mini load in LoadManager (#1565)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EmmyMiao87 authored and morningman committed Jul 30, 2019
1 parent e0d991f commit 8bc8fcf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public long createLoadJobFromMiniLoad(TMiniLoadBeginRequest request) throws User
.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();
Expand Down

0 comments on commit 8bc8fcf

Please sign in to comment.