This is an automated email from the ASF dual-hosted git repository.
iemejia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 8714557 [BEAM-11958] Don't use new Jackson APIs to avoid classpath
issues when parsing AWS configuration
new 10f5cbc Merge pull request #14199: [BEAM-11958] Don't use new Jackson
APIs to avoid classpath issues when parsing AWS configuration
8714557 is described below
commit 8714557b8917b723021fed84eeef66896ee68d1c
Author: Ismaël Mejía <[email protected]>
AuthorDate: Thu Mar 11 11:35:46 2021 +0100
[BEAM-11958] Don't use new Jackson APIs to avoid classpath issues when
parsing AWS configuration
Revert "[BEAM-8391] Update type id write methods in `AwsModule` from
deprecated (in jackson 2.9) to supported ones."
This reverts commit b68d70a47b68ad84efcd9405c1799002739bd116.
---
.../java/org/apache/beam/sdk/io/aws/options/AwsModule.java | 11 +++++------
.../java/org/apache/beam/sdk/io/aws2/options/AwsModule.java | 10 ++++------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git
a/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java
b/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java
index f873876..cb82463 100644
---
a/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java
+++
b/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java
@@ -34,9 +34,7 @@ import com.amazonaws.services.s3.model.SSECustomerKey;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
@@ -177,9 +175,9 @@ public class AwsModule extends SimpleModule {
SerializerProvider serializers,
TypeSerializer typeSerializer)
throws IOException {
- WritableTypeId typeId =
- typeSerializer.writeTypePrefix(
- jsonGenerator, typeSerializer.typeId(credentialsProvider,
JsonToken.START_OBJECT));
+ // BEAM-11958 Use deprecated Jackson APIs to be compatible with older
versions of jackson
+ typeSerializer.writeTypePrefixForObject(credentialsProvider,
jsonGenerator);
+
if
(credentialsProvider.getClass().equals(AWSStaticCredentialsProvider.class)) {
jsonGenerator.writeStringField(
AWS_ACCESS_KEY_ID,
credentialsProvider.getCredentials().getAWSAccessKeyId());
@@ -239,7 +237,8 @@ public class AwsModule extends SimpleModule {
throw new IllegalArgumentException(
"Unsupported AWS credentials provider type " +
credentialsProvider.getClass());
}
- typeSerializer.writeTypeSuffix(jsonGenerator, typeId);
+ // BEAM-11958 Use deprecated Jackson APIs to be compatible with older
versions of jackson
+ typeSerializer.writeTypeSuffixForObject(credentialsProvider,
jsonGenerator);
}
}
diff --git
a/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/options/AwsModule.java
b/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/options/AwsModule.java
index f8d1e52..5051438 100644
---
a/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/options/AwsModule.java
+++
b/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/options/AwsModule.java
@@ -20,9 +20,7 @@ package org.apache.beam.sdk.io.aws2.options;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
@@ -157,9 +155,8 @@ public class AwsModule extends SimpleModule {
SerializerProvider serializer,
TypeSerializer typeSerializer)
throws IOException {
- WritableTypeId typeId =
- typeSerializer.writeTypePrefix(
- jsonGenerator, typeSerializer.typeId(credentialsProvider,
JsonToken.START_OBJECT));
+ // BEAM-11958 Use deprecated Jackson APIs to be compatible with older
versions of jackson
+ typeSerializer.writeTypePrefixForObject(credentialsProvider,
jsonGenerator);
if
(credentialsProvider.getClass().equals(StaticCredentialsProvider.class)) {
jsonGenerator.writeStringField(
ACCESS_KEY_ID,
credentialsProvider.resolveCredentials().accessKeyId());
@@ -169,7 +166,8 @@ public class AwsModule extends SimpleModule {
throw new IllegalArgumentException(
"Unsupported AWS credentials provider type " +
credentialsProvider.getClass());
}
- typeSerializer.writeTypeSuffix(jsonGenerator, typeId);
+ // BEAM-11958 Use deprecated Jackson APIs to be compatible with older
versions of jackson
+ typeSerializer.writeTypeSuffixForObject(credentialsProvider,
jsonGenerator);
}
}