Skip to content

Commit

Permalink
fix(java-emitter): check for null callback (#3830)
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopjagadish authored Jan 5, 2022
1 parent 5b36944 commit daa20f8
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,23 @@ public void completed(HttpResponse response) {

@Override
public void failed(Exception ex) {
try {
callback.onFailure(ex);
} catch (Exception e) {
log.error("Error executing user callback on failure.", e);
if (callback != null) {
try {
callback.onFailure(ex);
} catch (Exception e) {
log.error("Error executing user callback on failure.", e);
}
}
}

@Override
public void cancelled() {
try {
callback.onFailure(new RuntimeException("Cancelled"));
} catch (Exception e) {
log.error("Error executing user callback on failure due to cancellation.", e);
if (callback != null) {
try {
callback.onFailure(new RuntimeException("Cancelled"));
} catch (Exception e) {
log.error("Error executing user callback on failure due to cancellation.", e);
}
}
}
};
Expand Down

0 comments on commit daa20f8

Please sign in to comment.