Skip to content

Commit

Permalink
Remove webURL check null
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonHxy committed Aug 22, 2023
1 parent d6734b7 commit b3d113e
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,12 @@ protected CompletableFuture<Void> validateTopicOwnershipAsync(TopicName topicNam
.build();

return nsService.getWebServiceUrlAsync(topicName, options)
.thenApply(webUrl -> {
// Ensure we get a url
if (webUrl == null || !webUrl.isPresent()) {
log.info("Unable to get web service url");
throw new RestException(Status.PRECONDITION_FAILED,
"Failed to find ownership for topic:" + topicName);
}
return webUrl.get();
}).thenCompose(webUrl -> nsService.isServiceUnitOwnedAsync(topicName)
.thenApply(webUrl ->
webUrl.orElseThrow(() -> {
log.info("Unable to get web service url");
throw new RestException(Status.PRECONDITION_FAILED,
"Failed to find ownership for topic:" + topicName);})
).thenCompose(webUrl -> nsService.isServiceUnitOwnedAsync(topicName)
.thenApply(isTopicOwned -> Pair.of(webUrl, isTopicOwned))
).thenAccept(pair -> {
URL webUrl = pair.getLeft();
Expand Down

0 comments on commit b3d113e

Please sign in to comment.