Skip to content

Commit ac0b41b

Browse files
committed
core: Validate load-balancing policy name early in ManagedChannelBuilder (#12695)
1 parent c43ded4 commit ac0b41b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

api/src/main/java/io/grpc/ManagedChannelBuilder.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package io.grpc;
1818

1919
import com.google.common.base.Preconditions;
20+
21+
import java.nio.channels.Channel;
2022
import java.util.List;
2123
import java.util.Map;
2224
import java.util.concurrent.Executor;
@@ -280,13 +282,12 @@ public T useTransportSecurity() {
280282
* @return this
281283
* @since 1.18.0
282284
*/
283-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
285+
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
284286
public T defaultLoadBalancingPolicy(String policy) {
285-
Preconditions.checkArgument(
286-
LoadBalancerRegistry.getDefaultRegistry().getProvider(policy) != null,
287-
"invalid load balancing policy %s", policy
288-
);
289-
throw new UnsupportedOperationException();
287+
Preconditions.checkArgument( // 4 spaces
288+
LoadBalancerRegistry.getDefaultRegistry().getProvider(policy) != null, // 8 spaces
289+
"invalid load balancing policy %s", policy); // 8 spaces
290+
throw new UnsupportedOperationException(); // 4 spaces
290291
}
291292

292293
/**

core/src/main/java/io/grpc/internal/ManagedChannelImplBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ public static ManagedChannelBuilder<?> forTarget(String target) {
213213
private boolean recordRetryMetrics = true;
214214
private boolean tracingEnabled = true;
215215
List<MetricSink> metricSinks = new ArrayList<>();
216-
217216
/**
218217
* An interface for Transport implementors to provide the {@link ClientTransportFactory}
219218
* appropriate for the channel.

0 commit comments

Comments
 (0)