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

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

                Author: ASF GitHub Bot
            Created on: 01/Apr/21 01:26
            Start Date: 01/Apr/21 01:26
    Worklog Time Spent: 10m 
      Work Description: avalanche123 commented on pull request #14400:
URL: https://github.com/apache/beam/pull/14400#issuecomment-811571389


   R: @Akshay-Iyangar 


-- 
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: 575270)
    Time Spent: 20m  (was: 10m)

> AwsOptions protobuf (de)serialization bug
> -----------------------------------------
>
>                 Key: BEAM-12081
>                 URL: https://issues.apache.org/jira/browse/BEAM-12081
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-aws
>            Reporter: Bulat Shakirzyanov
>            Priority: P2
>             Fix For: 2.28.0
>
>          Time Spent: 20m
>  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:
> Protobuf 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