-
Notifications
You must be signed in to change notification settings - Fork 320
Description
I spent some time troubleshooting (with assistance from Stephane Maldini) an issue pertaining to the collection of space user data in https://github.com/pacphi/cf-app-inventory-report. He encouraged me to file this issue afterward.
Having implemented this method in SpaceUsersTask...
protected Mono<SpaceUsers> getSpaceUsers(AppRequest request) {
return DefaultCloudFoundryOperations.builder()
.from(opsClient)
.organization(request.getOrganization())
.space(request.getSpace())
.build()
.userAdmin()
.listSpaceUsers(
ListSpaceUsersRequest
.builder()
.organizationName(request.getOrganization())
.spaceName(request.getSpace()).build()
)
.map(su -> SpaceUsers
.builder()
.organization(request.getOrganization())
.space(request.getSpace())
.auditors(su.getAuditors())
.managers(su.getManagers())
.developers(su.getDevelopers())
.build()
);
}
We had to introduce some unexpected protective logic to avoid a situation where DefaultUserAdmin.listSpaceUsers would produce random occurrences of NPE in one of its three dependent method calls to: listSpaceDeveloperNames, listSpaceManagerNames, and listSpaceAuditorNames.
So we added
.flux()
.onErrorContinue(
NullPointerException.class,
(data, e) -> OperationsLogging.log("Issue with space user" + data.getMessage()))
.next()
directly below the call to listSpaceUsers in my own implementation of getSpaceUsers above.
This occurred while using
org.cloudfoundry:cloudfoundry-client-reactor:3.13.0.RELEASEio.projectreactor:reactor-core:3.2.3.RELEASE
I believe the NPE should be handled by filtering for non-null usernames in each of the three method implementations mentioned above.