aromanenko-dev commented on code in PR #23553:
URL: https://github.com/apache/beam/pull/23553#discussion_r1001842666


##########
sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/options/AwsModule.java:
##########
@@ -228,6 +232,22 @@ public void serializeWithType(
           jsonGenerator.writeStringField(ACCESS_KEY_ID, 
credentials.accessKeyId());
           jsonGenerator.writeStringField(SECRET_ACCESS_KEY, 
credentials.secretAccessKey());
         }
+      } else if (providerClass.equals(ProfileCredentialsProvider.class)) {
+        String profileName = (String) readField(credentialsProvider, 
PROFILE_NAME);
+        String envProfileName = 
ProfileFileSystemSetting.AWS_PROFILE.getStringValueOrThrow();
+        if (profileName != null && !profileName.equals(envProfileName)) {
+          jsonGenerator.writeStringField(PROFILE_NAME, profileName);
+        }
+        try {
+          Exception exception = (Exception) readField(credentialsProvider, 
"loadException");
+          if (exception != null) {
+            LoggerFactory.getLogger(AwsModule.class)
+                .warn("Serialized ProfileCredentialsProvider in faulty 
state.", exception);
+          }
+        } catch (RuntimeException e) {
+          // can be ignored

Review Comment:
   Even if we can ignore it, I'd suggest to log this exception anyway. 
   
   Please, add a log message and self-merge after.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to