[ 
https://issues.apache.org/jira/browse/BEAM-12081?focusedWorklogId=575565&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-575565
 ]

ASF GitHub Bot logged work on BEAM-12081:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Apr/21 15:20
            Start Date: 01/Apr/21 15:20
    Worklog Time Spent: 10m 
      Work Description: aromanenko-dev commented on a change in pull request 
#14400:
URL: https://github.com/apache/beam/pull/14400#discussion_r605741329



##########
File path: 
sdks/java/io/amazon-web-services/src/test/java/org/apache/beam/sdk/io/aws/options/AwsModuleTest.java
##########
@@ -239,4 +242,22 @@ public void 
testAwsHttpClientConfigurationSerializationDeserialization() throws
     assertEquals(1000, 
clientConfigurationDeserialized.getConnectionMaxIdleMillis());
     assertEquals(300, clientConfigurationDeserialized.getSocketTimeout());
   }
+
+  @Test

Review comment:
       Could you add a test case with "-1" value, mentioned in Jira? 




-- 
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.

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 575565)
    Time Spent: 1h 10m  (was: 1h)

> Fix AwsOptions Jackson (de)serialization of integer values
> ----------------------------------------------------------
>
>                 Key: BEAM-12081
>                 URL: https://issues.apache.org/jira/browse/BEAM-12081
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-aws
>            Reporter: Bulat Shakirzyanov
>            Assignee: Bulat Shakirzyanov
>            Priority: P2
>             Fix For: 2.28.0
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Minimal test case to reproduce:
> {code:java}
> AwsOptions awsOptions = PipelineOptionsTranslation
>         .fromProto(PipelineOptionsTranslation.toProto(PipelineOptionsFactory
>                 .fromArgs("--clientConfiguration={ \"proxyPort\": -1 }")
>                 .create()
>         ))
>         .as(AwsOptions.class);
> System.out.println(awsOptions.getClientConfiguration());
> {code}
> Stacktrace:
> {code:java}
> java.lang.Double cannot be cast to java.lang.Integer
> java.lang.ClassCastException: java.lang.Double cannot be cast to 
> java.lang.Integer
>       at 
> org.apache.beam.sdk.io.aws.options.AwsModule$AwsHttpClientConfigurationDeserializer.deserialize(AwsModule.java:303)
>       at 
> org.apache.beam.sdk.io.aws.options.AwsModule$AwsHttpClientConfigurationDeserializer.deserialize(AwsModule.java:290)
>       at 
> com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4202)
>       at 
> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3205)
>       at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.getValueFromJson(ProxyInvocationHandler.java:511)
>       at 
> org.apache.beam.sdk.options.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:170)
>       at com.sun.proxy.$Proxy59.getClientConfiguration(Unknown Source)
> {code}
> Culprit:
> [https://github.com/apache/beam/blob/v2.28.0/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java#L303]
> Explanation:
> Jackson messages serialize numeric values as doubles. When options are later 
> deserialized from that format, the value of "proxyPort" is "-1.0" and not 
> "-1", leading to:
> {code:java}
> (Integer) Double.valueOf(-1.0)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to