File tree Expand file tree Collapse file tree 2 files changed +3
-23
lines changed
sdk-platform-java/gax-java/gax/src
main/java/com/google/api/gax/rpc
test/java/com/google/api/gax/rpc Expand file tree Collapse file tree 2 files changed +3
-23
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,6 @@ public static EndpointContext getDefaultInstance() {
134134
135135 public abstract String resolvedEndpoint ();
136136
137- @ Nullable
138137 public abstract String resolvedServerAddress ();
139138
140139 @ Nullable
@@ -411,7 +410,7 @@ private Integer parseServerPort(String endpoint) {
411410 return null ;
412411 }
413412 HostAndPort hostAndPort = parseServerHostAndPort (endpoint );
414- if (hostAndPort == null || !hostAndPort .hasPort ()) {
413+ if (!hostAndPort .hasPort ()) {
415414 return null ;
416415 }
417416 return hostAndPort .getPort ();
@@ -467,13 +466,8 @@ public EndpointContext build() throws IOException {
467466 setResolvedUniverseDomain (determineUniverseDomain ());
468467 String endpoint = determineEndpoint ();
469468 setResolvedEndpoint (endpoint );
470- try {
471- setResolvedServerAddress (parseServerAddress (resolvedEndpoint ()));
472- setResolvedServerPort (parseServerPort (resolvedEndpoint ()));
473- } catch (Exception throwable ) {
474- // Server address and server port are only used for observability.
475- // We should ignore any errors parsing them and not affect the main client requests.
476- }
469+ setResolvedServerAddress (parseServerAddress (resolvedEndpoint ()));
470+ setResolvedServerPort (parseServerPort (resolvedEndpoint ()));
477471 setUseS2A (shouldUseS2A ());
478472 return autoBuild ();
479473 }
Original file line number Diff line number Diff line change @@ -684,18 +684,4 @@ void endpointContextBuild_resolvesPort() throws IOException {
684684 Truth .assertThat (endpointContext .resolvedServerPort ()).isNull ();
685685 }
686686
687- @ Test
688- void endpointContextBuild_resolvesInvalidEndpointAndPort () throws Exception {
689-
690- String endpoint = "localhost:-1" ;
691-
692- EndpointContext endpointContext =
693- defaultEndpointContextBuilder
694- .setClientSettingsEndpoint (endpoint )
695- .setTransportChannelProviderEndpoint (null )
696- .build ();
697-
698- Truth .assertThat (endpointContext .resolvedServerAddress ()).isNull ();
699- Truth .assertThat (endpointContext .resolvedServerPort ()).isNull ();
700- }
701687}
You can’t perform that action at this time.
0 commit comments