diff --git a/checkstyle/suppressions.xml b/checkstyle/suppressions.xml index 41e5281728..e6563c305c 100644 --- a/checkstyle/suppressions.xml +++ b/checkstyle/suppressions.xml @@ -8,39 +8,39 @@ diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/PartitionsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/PartitionsResource.java index 34b1ca3e97..ced17f0b04 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/PartitionsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/PartitionsResource.java @@ -25,6 +25,8 @@ import io.confluent.kafkarest.extension.ResourceBlocklistFeature.ResourceName; import io.confluent.kafkarest.resources.AsyncResponses; import io.confluent.rest.annotations.PerformanceMetric; +import io.confluent.rest.exceptions.RestException; + import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -79,7 +81,7 @@ public void getPartition( CompletableFuture response = partitionManager.get() .getLocalPartition(topic, partitionId) - .thenApply(partition -> partition.orElseThrow(Errors::partitionNotFoundException)) + .thenApply(partition -> partition.orElseThrow(() -> Errors.partitionNotFoundException())) .thenApply(GetPartitionResponse::fromPartition); AsyncResponses.asyncResume(asyncResponse, response); @@ -103,7 +105,7 @@ public void getOffsets( CompletableFuture response = partitionManager.get() .getLocalPartition(topic, partitionId) - .thenApply(partition -> partition.orElseThrow(Errors::partitionNotFoundException)) + .thenApply(partition -> partition.orElseThrow(() -> Errors.partitionNotFoundException())) .thenApply( partition -> new TopicPartitionOffsetResponse( diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/TopicsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/TopicsResource.java index 9415dda5f7..8f4ab9f44a 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/TopicsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v2/TopicsResource.java @@ -26,6 +26,8 @@ import io.confluent.kafkarest.extension.ResourceBlocklistFeature.ResourceName; import io.confluent.kafkarest.resources.AsyncResponses; import io.confluent.rest.annotations.PerformanceMetric; +import io.confluent.rest.exceptions.RestException; + import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -80,7 +82,7 @@ public void getTopic( CompletableFuture topicFuture = topicManager.getLocalTopic(topicName) - .thenApply(topic -> topic.orElseThrow(Errors::topicNotFoundException)); + .thenApply(topic -> topic.orElseThrow(() -> Errors.topicNotFoundException())); CompletableFuture response = topicFuture.thenCompose( topic -> topicConfigManager.listTopicConfigs(topic.getClusterId(), topicName)) diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokerConfigsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokerConfigsResource.java index 13e4e55348..2d5055b9d2 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokerConfigsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokerConfigsResource.java @@ -121,7 +121,7 @@ public void getBrokerConfig( CompletableFuture response = brokerConfigManager.get() .getBrokerConfig(clusterId, brokerId, name) - .thenApply(broker -> broker.orElseThrow(NotFoundException::new)) + .thenApply(broker -> broker.orElseThrow(() -> new NotFoundException())) .thenApply(broker -> GetBrokerConfigResponse.create(toBrokerConfigData(broker))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokersResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokersResource.java index 03e7da4dc4..23eed0489e 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokersResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/BrokersResource.java @@ -102,7 +102,7 @@ public void getBroker( CompletableFuture response = brokerManager.get() .getBroker(clusterId, brokerId) - .thenApply(broker -> broker.orElseThrow(NotFoundException::new)) + .thenApply(broker -> broker.orElseThrow(() -> new NotFoundException())) .thenApply(broker -> GetBrokerResponse.create(toBrokerData(broker))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClusterConfigsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClusterConfigsResource.java index 85e2329049..20ab62248b 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClusterConfigsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClusterConfigsResource.java @@ -122,7 +122,7 @@ public void getClusterConfig( CompletableFuture response = clusterConfigManager.get() .getClusterConfig(clusterId, configType, name) - .thenApply(config -> config.orElseThrow(NotFoundException::new)) + .thenApply(config -> config.orElseThrow(() -> new NotFoundException())) .thenApply(config -> GetClusterConfigResponse.create(toClusterConfigData(config))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClustersResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClustersResource.java index cefe90f11a..6e79cb8b64 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClustersResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ClustersResource.java @@ -97,7 +97,7 @@ public void getCluster( CompletableFuture response = clusterManager.get() .getCluster(clusterId) - .thenApply(cluster -> cluster.orElseThrow(NotFoundException::new)) + .thenApply(cluster -> cluster.orElseThrow(() -> new NotFoundException())) .thenApply(cluster -> GetClusterResponse.create(toClusterData(cluster))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerAssignmentsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerAssignmentsResource.java index bf22786656..1475cb8812 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerAssignmentsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerAssignmentsResource.java @@ -124,7 +124,7 @@ public void getConsumerAssignment( CompletableFuture response = consumerAssignmentManager.get() .getConsumerAssignment(clusterId, consumerGroupId, consumerId, topicName, partitionId) - .thenApply(assignment -> assignment.orElseThrow(NotFoundException::new)) + .thenApply(assignment -> assignment.orElseThrow(() -> new NotFoundException())) .thenApply( assignment -> GetConsumerAssignmentResponse.create(toConsumerAssignmentData(assignment))); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerGroupsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerGroupsResource.java index 06b7d65671..5d89d0778c 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerGroupsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumerGroupsResource.java @@ -105,7 +105,7 @@ public void getConsumerGroup( CompletableFuture response = consumerGroupManager.get() .getConsumerGroup(clusterId, consumerGroupId) - .thenApply(consumerGroup -> consumerGroup.orElseThrow(NotFoundException::new)) + .thenApply(consumerGroup -> consumerGroup.orElseThrow(() -> new NotFoundException())) .thenApply( consumerGroup -> GetConsumerGroupResponse.create(toConsumerGroupData(clusterId, consumerGroup))); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumersResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumersResource.java index 8e2757c6d2..370a456e6a 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumersResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ConsumersResource.java @@ -112,7 +112,7 @@ public void getConsumer( CompletableFuture response = consumerManager.get() .getConsumer(clusterId, consumerGroupId, consumerId) - .thenApply(consumer -> consumer.orElseThrow(NotFoundException::new)) + .thenApply(consumer -> consumer.orElseThrow(() -> new NotFoundException())) .thenApply( consumer -> GetConsumerResponse.create(toConsumerData(consumer))); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/GetReassignmentAction.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/GetReassignmentAction.java index 120049834b..413da95ef4 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/GetReassignmentAction.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/GetReassignmentAction.java @@ -68,7 +68,7 @@ public void getReassignment( @PathParam("partitionId") Integer partitionId) { CompletableFuture response = reassignmentManager.get().getReassignment(clusterId, topicName, partitionId) - .thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new)) + .thenApply(reassignment -> reassignment.orElseThrow(() -> new NotFoundException())) .thenApply( reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment))); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/PartitionsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/PartitionsResource.java index 79cd975664..6530576f8b 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/PartitionsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/PartitionsResource.java @@ -110,7 +110,7 @@ public void getPartition( CompletableFuture response = partitionManager.get() .getPartition(clusterId, topicName, partitionId) - .thenApply(partition -> partition.orElseThrow(NotFoundException::new)) + .thenApply(partition -> partition.orElseThrow(() -> new NotFoundException())) .thenApply(partition -> GetPartitionResponse.create(toPartitionData(partition))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ReplicasResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ReplicasResource.java index 643a428297..a5b556fe4f 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ReplicasResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/ReplicasResource.java @@ -113,7 +113,7 @@ public void getReplica( CompletableFuture response = replicaManager.get() .getReplica(clusterId, topicName, partitionId, brokerId) - .thenApply(replica -> replica.orElseThrow(NotFoundException::new)) + .thenApply(replica -> replica.orElseThrow(() -> new NotFoundException())) .thenApply(replica -> GetReplicaResponse.create(toReplicaData(replica))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicConfigsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicConfigsResource.java index 3759a8162d..c200c65b37 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicConfigsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicConfigsResource.java @@ -121,7 +121,7 @@ public void getTopicConfig( CompletableFuture response = topicConfigManager.get() .getTopicConfig(clusterId, topicName, name) - .thenApply(topic -> topic.orElseThrow(NotFoundException::new)) + .thenApply(topic -> topic.orElseThrow(() -> new NotFoundException())) .thenApply(topic -> GetTopicConfigResponse.create(toTopicConfigData(topic))); AsyncResponses.asyncResume(asyncResponse, response); diff --git a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicsResource.java b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicsResource.java index 2c522722da..d52044ff87 100644 --- a/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicsResource.java +++ b/kafka-rest/src/main/java/io/confluent/kafkarest/resources/v3/TopicsResource.java @@ -118,7 +118,7 @@ public void getTopic( CompletableFuture response = topicManager.get() .getTopic(clusterId, topicName) - .thenApply(topic -> topic.orElseThrow(NotFoundException::new)) + .thenApply(topic -> topic.orElseThrow(() -> new NotFoundException())) .thenApply(topic -> GetTopicResponse.create(toTopicData(topic))); AsyncResponses.asyncResume(asyncResponse, response);