Skip to content

Commit a99c8d1

Browse files
committed
xds: Avoid default locale and reset()
Found via linter
1 parent 0847e2b commit a99c8d1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ private static boolean matchPath(PathMatcher pathMatcher, String fullMethodName)
165165
} else if (pathMatcher.prefix() != null) {
166166
return pathMatcher.caseSensitive()
167167
? fullMethodName.startsWith(pathMatcher.prefix())
168-
: fullMethodName.toLowerCase().startsWith(pathMatcher.prefix().toLowerCase());
168+
: fullMethodName.toLowerCase(Locale.US).startsWith(
169+
pathMatcher.prefix().toLowerCase(Locale.US));
169170
}
170171
return pathMatcher.regEx().matches(fullMethodName);
171172
}

xds/src/test/java/io/grpc/xds/orca/OrcaServiceImplTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.truth.Truth.assertThat;
2020
import static org.mockito.ArgumentMatchers.any;
2121
import static org.mockito.ArgumentMatchers.eq;
22+
import static org.mockito.Mockito.never;
2223
import static org.mockito.Mockito.reset;
2324
import static org.mockito.Mockito.times;
2425
import static org.mockito.Mockito.verify;
@@ -115,7 +116,6 @@ public void testReportingLifeCycle() {
115116
}
116117

117118
@Test
118-
@SuppressWarnings("unchecked")
119119
public void testReportingLifeCycle_serverShutdown() {
120120
ClientCall<OrcaLoadReportRequest, OrcaLoadReport> call = channel.newCall(
121121
OpenRcaServiceGrpc.getStreamCoreMetricsMethod(), CallOptions.DEFAULT);
@@ -128,7 +128,7 @@ public void testReportingLifeCycle_serverShutdown() {
128128
OrcaLoadReport expect = OrcaLoadReport.newBuilder().putUtilization("buffer", 0.2).build();
129129
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(1);
130130
verify(listener).onMessage(eq(expect));
131-
reset(listener);
131+
verify(listener, never()).onClose(any(), any());
132132
oobServer.shutdownNow();
133133
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
134134
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);

0 commit comments

Comments
 (0)