Skip to content

Commit 76aec01

Browse files
authored
Fix Java SDK URI parsing. (#882)
Signed-off-by: Artur Souza <[email protected]>
1 parent 201dbc5 commit 76aec01

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sdk/src/main/java/io/dapr/client/DaprClientBuilder.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,20 @@ private DaprClient buildDaprClientGrpc() {
170170
}
171171

172172
private ManagedChannel buildGrpcManagedChanel() {
173-
String host = Properties.SIDECAR_IP.get();
173+
String address = Properties.SIDECAR_IP.get();
174174
int port = Properties.GRPC_PORT.get();
175175
boolean insecure = true;
176176
String grpcEndpoint = Properties.GRPC_ENDPOINT.get();
177177
if ((grpcEndpoint != null) && !grpcEndpoint.isEmpty()) {
178178
URI uri = URI.create(grpcEndpoint);
179179
insecure = uri.getScheme().equalsIgnoreCase("http");
180180
port = uri.getPort() > 0 ? uri.getPort() : (insecure ? 80 : 443);
181+
address = uri.getHost();
182+
if ((uri.getPath() != null) && !uri.getPath().isEmpty()) {
183+
address += uri.getPath();
184+
}
181185
}
182-
ManagedChannelBuilder builder = ManagedChannelBuilder.forAddress(host, port)
186+
ManagedChannelBuilder builder = ManagedChannelBuilder.forAddress(address, port)
183187
.userAgent(Version.getSdkVersion());
184188
if (insecure) {
185189
builder = builder.usePlaintext();

0 commit comments

Comments
 (0)