diff --git a/sdks/java/transform-service/docker-compose/.env b/sdks/java/transform-service/docker-compose/.env index 39813124648b..ed27b267fed3 100644 --- a/sdks/java/transform-service/docker-compose/.env +++ b/sdks/java/transform-service/docker-compose/.env @@ -16,8 +16,8 @@ DEPENDENCIES_VOLUME=$DEPENDENCIES_VOLUME # A requirements file with either of the following # * PyPi packages -# Locally available packages relative to the directory provided to -# DEPENDENCIES_VOLUME. +# * Locally available packages relative to the directory provided to +# DEPENDENCIES_VOLUME. PYTHON_REQUIREMENTS_FILE_NAME=$PYTHON_REQUIREMENTS_FILE_NAME GOOGLE_APPLICATION_CREDENTIALS_FILE_NAME=application_default_credentials.json diff --git a/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java b/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java index b9739f5d0582..0a2e65099e7d 100644 --- a/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java +++ b/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java @@ -76,8 +76,12 @@ private void waitForAllServicesToBeReady() throws TimeoutException { try { String url = endpoint.getUrl(); int portIndex = url.lastIndexOf(":"); - int port = portIndex > 0 ? Integer.parseInt(url.substring(portIndex + 1)) : 80; - String host = portIndex > 0 ? url.substring(0, portIndex) : url; + if (portIndex <= 0) { + throw new RuntimeException( + "Expected the endpoint to be of the form : but received " + url); + } + int port = Integer.parseInt(url.substring(portIndex + 1)); + String host = url.substring(0, portIndex); new Socket(host, port).close(); // Current service is up. Checking the next one. continue outer;