Skip to content

Commit

Permalink
Re-fix NPEs in notifications
Browse files Browse the repository at this point in the history
(cherry picked from commit 8162efd)
  • Loading branch information
mederly committed Apr 3, 2020
1 parent 2183ab0 commit 9a38a1b
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -236,14 +236,16 @@ public boolean hasContentToShow(boolean watchAuxiliaryAttributes) {
ObjectDelta<? extends ObjectType> summarizedDelta;
try {
summarizedDelta = getSummarizedFocusDeltas();
if (!ObjectDelta.isModify(summarizedDelta)) {
if (summarizedDelta == null) {
return false;
} else if (summarizedDelta.isAdd() || summarizedDelta.isDelete()) {
return true;
} else if (!getTextFormatter().containsVisibleModifiedItems(summarizedDelta.getModifications(),
} else if (getTextFormatter().containsVisibleModifiedItems(summarizedDelta.getModifications(),
false, watchAuxiliaryAttributes)) {
return true;
} else {
LOGGER.trace("No relevant attributes in modify delta (watchAux={})", watchAuxiliaryAttributes);
return false;
} else {
return true;
}
} catch (Throwable t) {
LoggingUtils.logUnexpectedException(LOGGER, "Unable to check if there's content to show; focus context = {}", t, focusContext.debugDump());
Expand All @@ -255,9 +257,11 @@ public boolean hasContentToShow(boolean watchAuxiliaryAttributes) {
public String getContentAsFormattedList(boolean showAuxiliaryAttributes) {
try {
ObjectDelta<? extends ObjectType> summarizedDelta = getSummarizedFocusDeltas();
if (ObjectDelta.isAdd(summarizedDelta)) {
if (summarizedDelta == null) {
return ""; // should not happen
} else if (summarizedDelta.isAdd()) {
return getTextFormatter().formatObject(summarizedDelta.getObjectToAdd(), false, showAuxiliaryAttributes);
} else if (ObjectDelta.isModify(summarizedDelta)) {
} else if (summarizedDelta.isModify()) {
ModelElementContext<?> focusContext = modelContext.getFocusContext();
return getTextFormatter().formatObjectModificationDelta(summarizedDelta, false, showAuxiliaryAttributes, focusContext.getObjectOld(),
focusContext.getObjectNew());
Expand Down

0 comments on commit 9a38a1b

Please sign in to comment.