Skip to content

Commit cf52bd8

Browse files
committed
Update Javadoc and exception message as per review comment
1 parent 97ab8b2 commit cf52bd8

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎flight/flight-core/src/main/java/org/apache/arrow/flight/FlightClient.java‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,13 @@ public Builder verifyServer(boolean verifyServer) {
822822
return this;
823823
}
824824

825-
/** Create the client from this builder. */
825+
/**
826+
* Create the client from this builder.
827+
*
828+
* @throws IllegalArgumentException if the location uses a TCP-based scheme ({@code grpc},
829+
* {@code grpc+tcp}, {@code grpc+tls}) and the location contains no port, or a port outside
830+
* the range [1, 65535].
831+
*/
826832
public FlightClient build() {
827833
final NettyChannelBuilder channelBuilder = builder.build();
828834
return new FlightClient(builder.allocator(), channelBuilder.build(), builder.middleware());

‎flight/flight-core/src/main/java/org/apache/arrow/flight/grpc/NettyClientBuilder.java‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ public NettyClientBuilder verifyServer(boolean verifyServer) {
130130
return this;
131131
}
132132

133-
/** Create the client from this builder. */
133+
/**
134+
* Create the client from this builder.
135+
*
136+
* @throws IllegalArgumentException if the URI uses a TCP-based scheme ({@code grpc}, {@code
137+
* grpc+tcp}, {@code grpc+tls}) and the URI contains no port, or a port outside the range [1,
138+
* 65535].
139+
*/
134140
public NettyChannelBuilder build() {
135141
final NettyChannelBuilder builder;
136142

@@ -140,6 +146,10 @@ public NettyChannelBuilder build() {
140146
case LocationSchemes.GRPC_TLS:
141147
{
142148
final int port = location.getUri().getPort();
149+
if (port == -1) {
150+
throw new IllegalArgumentException(
151+
"No port specified in location URI: " + location.getUri());
152+
}
143153
if (port < 1 || port > 65535) {
144154
throw new IllegalArgumentException(
145155
"Invalid port " + port + ": must be between 1 and 65535.");

0 commit comments

Comments
 (0)