• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #20181

04 Mar 2026 06:08PM UTC coverage: 88.684%. Remained the same
#20181

push

github

ejona86
Revert "fix(xds): Allow and normalize trailing dot (FQDN) in matchHostName (#12644)"

We want to synchronize the behavior across all gRPC languages, and also with envoy.

This reverts commit 0ef1b392b.

35461 of 39986 relevant lines covered (88.68%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/../netty/src/main/java/io/grpc/netty/UdsNameResolver.java
1
/*
2
 * Copyright 2022 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.netty;
18

19
import static com.google.common.base.Preconditions.checkArgument;
20
import static com.google.common.base.Preconditions.checkNotNull;
21
import static com.google.common.base.Strings.isNullOrEmpty;
22

23
import com.google.common.base.Preconditions;
24
import io.grpc.EquivalentAddressGroup;
25
import io.grpc.NameResolver;
26
import io.grpc.StatusOr;
27
import io.netty.channel.unix.DomainSocketAddress;
28
import java.util.ArrayList;
29
import java.util.List;
30

31
final class UdsNameResolver extends NameResolver {
32
  private NameResolver.Listener2 listener;
33
  private final String authority;
34

35
  /**
36
   * Constructs a new instance of UdsNameResolver.
37
   *
38
   * @param authority authority of the 'unix:' URI to resolve, or null if target has no authority
39
   * @param targetPath path of the 'unix:' URI to resolve
40
   */
41
  UdsNameResolver(String authority, String targetPath, Args args) {
1✔
42
    // UDS is inherently local. According to https://github.com/grpc/grpc/blob/master/doc/naming.md,
43
    // this is expressed in the target URI either by using a blank authority, like "unix:///sock",
44
    // or by omitting authority completely, e.g. "unix:/sock".
45
    // TODO(jdcormie): Allow the explicit authority string "localhost"?
46
    checkArgument(isNullOrEmpty(authority), "authority not supported: %s", authority);
1✔
47
    this.authority = targetPath;
1✔
48
  }
1✔
49

50
  @Override
51
  public String getServiceAuthority() {
52
    return this.authority;
1✔
53
  }
54

55
  @Override
56
  public void start(Listener2 listener) {
57
    Preconditions.checkState(this.listener == null, "already started");
1✔
58
    this.listener = checkNotNull(listener, "listener");
1✔
59
    resolve();
1✔
60
  }
1✔
61

62
  @Override
63
  public void refresh() {
64
    resolve();
×
65
  }
×
66

67
  private void resolve() {
68
    ResolutionResult.Builder resolutionResultBuilder = ResolutionResult.newBuilder();
1✔
69
    List<EquivalentAddressGroup> servers = new ArrayList<>(1);
1✔
70
    servers.add(new EquivalentAddressGroup(new DomainSocketAddress(authority)));
1✔
71
    resolutionResultBuilder.setAddressesOrError(StatusOr.fromValue(servers));
1✔
72
    listener.onResult2(resolutionResultBuilder.build());
1✔
73
  }
1✔
74

75
  @Override
76
  public void shutdown() {}
1✔
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc