Skip to content

Commit 7a63a0b

Browse files
committed
Allow configuration to be serialized
1 parent a4aa6f1 commit 7a63a0b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/kinesis/KinesisTransformRegistrar.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ public PTransform<PCollection<byte[]>, KinesisIO.Write.Result> buildExternal(
104104
AwsBasicCredentials.create(configuration.awsAccessKey, configuration.awsSecretKey);
105105
StaticCredentialsProvider provider = StaticCredentialsProvider.create(creds);
106106
SerializableFunction<byte[], byte[]> serializer = v -> v;
107-
@Nullable URI endpoint;
107+
@Nullable URI endpoint = null;
108108
if (configuration.serviceEndpoint != null) {
109109
try {
110-
endpoint = configuration.serviceEndpoint;
110+
endpoint = new URI(configuration.serviceEndpoint);
111111
}
112112
catch (URISyntaxException ex) {
113113
throw new RuntimeException(
114-
String.format("Service endpoint must be URI format, got: %s", serviceEndpoint));
114+
String.format("Service endpoint must be URI format, got: %s", configuration.serviceEndpoint));
115115
}
116116
}
117117
KinesisIO.Write<byte[]> writeTransform =
@@ -214,14 +214,14 @@ public PTransform<PBegin, PCollection<byte[]>> buildExternal(
214214
AwsBasicCredentials creds =
215215
AwsBasicCredentials.create(configuration.awsAccessKey, configuration.awsSecretKey);
216216
StaticCredentialsProvider provider = StaticCredentialsProvider.create(creds);
217-
@Nullable URI endpoint;
217+
@Nullable URI endpoint = null;
218218
if (configuration.serviceEndpoint != null) {
219219
try {
220-
endpoint = configuration.serviceEndpoint;
220+
endpoint = new URI(configuration.serviceEndpoint);
221221
}
222222
catch (URISyntaxException ex) {
223223
throw new RuntimeException(
224-
String.format("Service endpoint must be URI format, got: %s", serviceEndpoint));
224+
String.format("Service endpoint must be URI format, got: %s", configuration.serviceEndpoint));
225225
}
226226
}
227227
KinesisIO.Read readTransform =

0 commit comments

Comments
 (0)