Skip to content

Commit

Permalink
updating eventReceived to handle null resources
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed Apr 21, 2021
1 parent 4c8c8ef commit 7a95e59
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ public ReflectorWatcher(Store<T> store, AtomicReference<String> lastSyncResource
@Override
public void eventReceived(Action action, T resource) {
if (action == null) {
final String errorMessage = String.format("Unrecognized event %s", resource.getMetadata().getName());
throw new KubernetesClientException(errorMessage);
throw new KubernetesClientException("Unrecognized event");
}
if (resource == null) {
throw new KubernetesClientException("Unrecognized resource");
}
if (log.isDebugEnabled()) {
log.debug("Event received {} {}# resourceVersion {}", action.name(), resource.getKind(), resource.getMetadata().getResourceVersion());
}
switch (action) {
case ERROR:
final String errorMessage = String.format("ERROR event for %s", resource.getMetadata().getName());
throw new KubernetesClientException(errorMessage);
throw new KubernetesClientException("ERROR event");
case ADDED:
store.add(resource);
break;
Expand Down

0 comments on commit 7a95e59

Please sign in to comment.