You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/04/01 07:14:00 UTC

[jira] [Work logged] (BEAM-12081) Fix AwsOptions Jackson (de)serialization of integer values

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

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

                Author: ASF GitHub Bot
            Created on: 01/Apr/21 07:13
            Start Date: 01/Apr/21 07:13
    Worklog Time Spent: 10m 
      Work Description: iemejia edited a comment on pull request #14400:
URL: https://github.com/apache/beam/pull/14400#issuecomment-811699441


   Thanks for your contribution. Can you please check (and fix if possible) this for the [amazon-web-services2](https://github.com/apache/beam/blob/7963cd3329f5349cb3ad93e0bbdebebdeeb3b86f/sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsModule.java#L302) module too.
   


-- 
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:
users@infra.apache.org


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

    Worklog Id:     (was: 575355)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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)