Committed by
Gerrit Code Review
Fix NPE when processing an event when the delegate is undefined
Change-Id: I44d6c50db8804ccfda1c8b8800360ee705fb331d
Showing
1 changed file
with
6 additions
and
6 deletions
| ... | @@ -426,7 +426,7 @@ public class DistributedApplicationStore extends ApplicationArchive | ... | @@ -426,7 +426,7 @@ public class DistributedApplicationStore extends ApplicationArchive |
| 426 | return new InternalApplicationHolder(v.app(), v.state(), ImmutableSet.copyOf(permissions)); | 426 | return new InternalApplicationHolder(v.app(), v.state(), ImmutableSet.copyOf(permissions)); |
| 427 | }); | 427 | }); |
| 428 | if (permissionsChanged.get()) { | 428 | if (permissionsChanged.get()) { |
| 429 | - delegate.notify(new ApplicationEvent(APP_PERMISSIONS_CHANGED, appHolder.value().app())); | 429 | + notifyDelegate(new ApplicationEvent(APP_PERMISSIONS_CHANGED, appHolder.value().app())); |
| 430 | } | 430 | } |
| 431 | } | 431 | } |
| 432 | 432 | ||
| ... | @@ -436,7 +436,7 @@ public class DistributedApplicationStore extends ApplicationArchive | ... | @@ -436,7 +436,7 @@ public class DistributedApplicationStore extends ApplicationArchive |
| 436 | String appName = app.id().name(); | 436 | String appName = app.id().name(); |
| 437 | installAppIfNeeded(app); | 437 | installAppIfNeeded(app); |
| 438 | setActive(appName); | 438 | setActive(appName); |
| 439 | - delegate.notify(new ApplicationEvent(APP_ACTIVATED, app)); | 439 | + notifyDelegate(new ApplicationEvent(APP_ACTIVATED, app)); |
| 440 | } | 440 | } |
| 441 | } | 441 | } |
| 442 | 442 | ||
| ... | @@ -460,7 +460,7 @@ public class DistributedApplicationStore extends ApplicationArchive | ... | @@ -460,7 +460,7 @@ public class DistributedApplicationStore extends ApplicationArchive |
| 460 | } | 460 | } |
| 461 | setupApplicationAndNotify(appId, newApp.app(), newApp.state()); | 461 | setupApplicationAndNotify(appId, newApp.app(), newApp.state()); |
| 462 | } else if (event.type() == MapEvent.Type.REMOVE) { | 462 | } else if (event.type() == MapEvent.Type.REMOVE) { |
| 463 | - delegate.notify(new ApplicationEvent(APP_UNINSTALLED, oldApp.app())); | 463 | + notifyDelegate(new ApplicationEvent(APP_UNINSTALLED, oldApp.app())); |
| 464 | purgeApplication(appId.name()); | 464 | purgeApplication(appId.name()); |
| 465 | } | 465 | } |
| 466 | } | 466 | } |
| ... | @@ -470,10 +470,10 @@ public class DistributedApplicationStore extends ApplicationArchive | ... | @@ -470,10 +470,10 @@ public class DistributedApplicationStore extends ApplicationArchive |
| 470 | // ACTIVATED state is handled separately in NextAppToActivateValueListener | 470 | // ACTIVATED state is handled separately in NextAppToActivateValueListener |
| 471 | if (state == INSTALLED) { | 471 | if (state == INSTALLED) { |
| 472 | fetchBitsIfNeeded(app); | 472 | fetchBitsIfNeeded(app); |
| 473 | - delegate.notify(new ApplicationEvent(APP_INSTALLED, app)); | 473 | + notifyDelegate(new ApplicationEvent(APP_INSTALLED, app)); |
| 474 | } else if (state == DEACTIVATED) { | 474 | } else if (state == DEACTIVATED) { |
| 475 | clearActive(appId.name()); | 475 | clearActive(appId.name()); |
| 476 | - delegate.notify(new ApplicationEvent(APP_DEACTIVATED, app)); | 476 | + notifyDelegate(new ApplicationEvent(APP_DEACTIVATED, app)); |
| 477 | } | 477 | } |
| 478 | } | 478 | } |
| 479 | 479 | ||
| ... | @@ -504,7 +504,7 @@ public class DistributedApplicationStore extends ApplicationArchive | ... | @@ -504,7 +504,7 @@ public class DistributedApplicationStore extends ApplicationArchive |
| 504 | private void installAppIfNeeded(Application app) { | 504 | private void installAppIfNeeded(Application app) { |
| 505 | if (!appBitsAvailable(app)) { | 505 | if (!appBitsAvailable(app)) { |
| 506 | fetchBits(app); | 506 | fetchBits(app); |
| 507 | - delegate.notify(new ApplicationEvent(APP_INSTALLED, app)); | 507 | + notifyDelegate(new ApplicationEvent(APP_INSTALLED, app)); |
| 508 | } | 508 | } |
| 509 | } | 509 | } |
| 510 | 510 | ... | ... |
-
Please register or login to post a comment