Skip to content

Commit 64e7c1c

Browse files
committed
fix warnings
1 parent cd6c611 commit 64e7c1c

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

xds/src/main/java/io/grpc/xds/CompositeFilter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
import java.util.List;
4949
import java.util.concurrent.ScheduledExecutorService;
5050
import java.util.concurrent.ThreadLocalRandom;
51+
import java.util.logging.Level;
52+
import java.util.logging.Logger;
5153
import javax.annotation.Nullable;
5254
import javax.net.ssl.SNIHostName;
5355
import javax.net.ssl.SNIServerName;
@@ -74,6 +76,7 @@ public final class CompositeFilter implements Filter {
7476
"type.googleapis.com/envoy.extensions.matching.common_inputs.network.v3.ServerNameInput";
7577

7678
private static final CompositeFilter INSTANCE = new CompositeFilter();
79+
private static final Logger log = Logger.getLogger(CompositeFilter.class.getName());
7780

7881
private CompositeFilter() {
7982
}
@@ -424,7 +427,7 @@ public String getRelayedInput(com.github.xds.core.v3.TypedExtensionConfig inputC
424427
String headerName = input.getHeaderName();
425428
return headers.get(Metadata.Key.of(headerName, Metadata.ASCII_STRING_MARSHALLER));
426429
} catch (InvalidProtocolBufferException e) {
427-
// log/ignore
430+
log.log(Level.WARNING, "Unable to get headers from the request for matching", e);
428431
}
429432
} else if (TYPE_URL_SOURCE_IP_INPUT.equals(typeUrl)) {
430433
SocketAddress addr = attributes.get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR);

xds/src/main/java/io/grpc/xds/XdsNameResolver.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ private void updateResolutionResult(XdsConfig xdsConfig) {
336336
.setAttributes(attrs)
337337
.setServiceConfig(parsedServiceConfig)
338338
.build();
339-
// todo: abhishek probably the filters are getting applied here ??
340339
if (!listener.onResult2(result).isOk()) {
341340
resolveState.xdsDependencyManager.requestReresolution();
342341
}
@@ -405,7 +404,6 @@ static boolean matchHostName(String hostName, String pattern) {
405404
private final class ConfigSelector extends InternalConfigSelector {
406405
@Override
407406
public Result selectConfig(PickSubchannelArgs args) {
408-
// todo: AgraVator probably the filters are getting populated here
409407
RoutingConfig routingCfg;
410408
RouteData selectedRoute;
411409
String cluster;

xds/src/test/java/io/grpc/xds/CompositeFilterTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.mockito.MockitoAnnotations;
4949

5050
@RunWith(JUnit4.class)
51+
@SuppressWarnings({ "rawtypes", "unchecked" })
5152
public class CompositeFilterTest {
5253

5354
private final CompositeFilter.Provider provider = new CompositeFilter.Provider();
@@ -157,7 +158,6 @@ public void parseConfig() {
157158
}
158159

159160
@Test
160-
@SuppressWarnings("unchecked")
161161
public void clientInterceptorDelegates() {
162162
// Setup Config with simple matcher equivalent logic
163163
Matcher.OnMatch matchAction = Matcher.OnMatch.newBuilder()
@@ -255,9 +255,8 @@ public void clientInterceptorDelegates() {
255255
}
256256

257257
@Test
258-
@SuppressWarnings("unchecked")
259258
public void clientInterceptorSkips() {
260-
// Same setup but no match
259+
// Setup Config with simple matcher equivalent logic with no match
261260
Matcher matcher = Matcher.newBuilder().build();
262261

263262
ExtensionWithMatcher proto = ExtensionWithMatcher.newBuilder()
@@ -289,12 +288,12 @@ public void clientInterceptorSkips() {
289288
Metadata headers = new Metadata();
290289
call.start(mock(ClientCall.Listener.class), headers);
291290

291+
verify(fakeClientInterceptor, org.mockito.Mockito.never()).interceptCall(any(), any(), any());
292292
verify(next).newCall(any(), any());
293293
verify(nextCall).start(any(), eq(headers));
294294
}
295295

296296
@Test
297-
@SuppressWarnings("unchecked")
298297
public void clientInterceptorDelegatesChain() {
299298
// Setup Chain Action
300299
TypedExtensionConfig child1 = TypedExtensionConfig.newBuilder()
@@ -393,7 +392,6 @@ public void clientInterceptorDelegatesChain() {
393392
fakeClientInterceptor = mock(ClientInterceptor.class);
394393
when(fakeFilter.buildClientInterceptor(any(), any(), any())).thenReturn(fakeClientInterceptor);
395394

396-
ClientCall childCall = mock(ClientCall.class);
397395
org.mockito.Mockito.doAnswer(invocation -> {
398396
io.grpc.Channel nextArg = (io.grpc.Channel) invocation.getArguments()[2];
399397
return nextArg.newCall(

0 commit comments

Comments
 (0)