Fix #7900 Backend: Fix NPE in tests (#7902)

This commit is contained in:
Vivek Ratnavel Subramanian 2022-10-04 12:46:50 -07:00 committed by GitHub
parent 64fdebe491
commit 2557feef3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -104,7 +104,7 @@ public class ChangeEventHandler implements EventHandler {
if (filterEnabled) {
for (var thread : listOrEmpty(getThreads(responseContext, loggedInUserName))) {
// Don't create a thread if there is no message
if (!thread.getMessage().isEmpty()) {
if (thread.getMessage() != null && !thread.getMessage().isEmpty()) {
EntityInterface entity;
// In case of ENTITY_FIELDS_CHANGED entity from responseContext will be a ChangeEvent
if (responseContext.getEntity() instanceof ChangeEvent) {

View File

@ -200,9 +200,11 @@ public class WebhookPublisher extends AbstractEventPublisher {
}
} catch (Exception ex) {
Throwable cause = ex.getCause();
if (cause.getClass() == UnknownHostException.class) {
if (cause != null && cause.getClass() == UnknownHostException.class) {
LOG.warn("Invalid webhook {} endpoint {}", webhook.getName(), webhook.getEndpoint());
setErrorStatus(attemptTime, null, "UnknownHostException");
} else {
LOG.debug("Exception occurred while publishing webhook", ex);
}
}
}