Skip to content

Conversation

@brettcooper
Copy link

@brettcooper brettcooper commented Oct 24, 2019

We are using Restlet version 2.4.1 to communicate with 3rd party API's like Shopify and certain API's are returning Retry-After headers as doubles instead of integers. This is causing Restlet to throw a NumberFormatException like below and is not processing the message correctly.

Error during Retry-After header parsing. Header: 4.0
LOGGER NAME
org.restlet
THREAD NAME
RecordProcessor-0001

ERROR KIND
java.lang.NumberFormatException
ERROR MESSAGE
For input string: "4.0"
ERROR STACK
java.lang.NumberFormatException: For input string: "4.0"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.restlet.engine.header.HeaderUtils.copyResponseTransportHeaders(HeaderUtils.java:756)
at org.restlet.engine.adapter.ClientAdapter.readResponseHeaders(ClientAdapter.java:128)
at org.restlet.engine.adapter.ClientAdapter.updateResponse(ClientAdapter.java:190)
at org.restlet.engine.adapter.ClientAdapter.commit(ClientAdapter.java:105)
at org.restlet.engine.adapter.HttpClientHelper.handle(HttpClientHelper.java:119)
at org.restlet.Client.handle(Client.java:153)
at org.restlet.routing.Filter.doHandle(Filter.java:150)
at org.restlet.routing.Filter.handle(Filter.java:197)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1122)
at com.unific.shopify.clients.rest.ShopifyClientResource.handle(ShopifyClientResource.java:38)
at org.restlet.resource.ClientResource.handleOutbound(ClientResource.java:1208)
at org.restlet.engine.resource.ClientInvocationHandler.invoke(ClientInvocationHandler.java:263)
at com.sun.proxy.$Proxy219.createPriceRule(Unknown Source)
at com.unific.shopify.clients.rest.PriceRuleRestClient.createPriceRule(PriceRuleRestClient.java:66)
at com.unific.coupon.store.ShopifyCouponGenerator.generatePriceRule(ShopifyCouponGenerator.java:123)
at com.unific.coupon.store.ShopifyCouponGenerator.generate(ShopifyCouponGenerator.java:88)
at com.unific.coupon.store.CouponGeneratorRegistry.generate(CouponGeneratorRegistry.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at com.unific.featureflag.FeatureProxyFactoryBean.lambda$getObject$0(FeatureProxyFactoryBean.java:66)
at com.sun.proxy.$Proxy160.generate(Unknown Source)
at com.unific.coupon.CouponService.process(CouponService.java:83)
at com.unific.coupon.DiscountCodeRequestStreamRecordProcessor.process(DiscountCodeRequestStreamRecordProcessor.java:33)
at com.unific.coupon.DiscountCodeRequestStreamRecordProcessor.process(DiscountCodeRequestStreamRecordProcessor.java:13)
at com.unific.aws.kinesis.client.KinesisRecordProcessor.processRecords(KinesisRecordProcessor.java:102)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.callProcessRecords(ProcessTask.java:221)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.call(ProcessTask.java:176)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:49)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:24)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)

@thboileau
Copy link
Contributor

thboileau commented Dec 23, 2019

Hello @brettcooper

Many thanks for your contribution.

I see your PR is based on branch 2.3 but you told that you are using RF v2.4.1.
My guess is that you prefer 2.4, right?

In addition, as you become contributor of the Restlet Framework, do you mind to read the following https://github.com/restlet/restlet-framework-java/wiki/Contribute#submit-contributions

and return a signed copy of the Joint Copyright Assignement at jlouvel@talend.com?

@thboileau
Copy link
Contributor

Hi @brettcooper

after discussion with Jérôme, don't mind about the JCA. I'll take care of the fix.
thanks again about the contribution.

@thboileau
Copy link
Contributor

thboileau commented Dec 26, 2019

The fix has been applied on the branches 2.4 and 2.5. It will be part of incoming 2.4.3 and 2.5m1 versions
cf

@thboileau thboileau closed this Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants