Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

HTTP Binding : Issue when URL has spaces being 20% #4459

Closed
TommySharpNZ opened this issue Jun 12, 2016 · 1 comment
Closed

HTTP Binding : Issue when URL has spaces being 20% #4459

TommySharpNZ opened this issue Jun 12, 2016 · 1 comment
Assignees
Milestone

Comments

@TommySharpNZ
Copy link

TommySharpNZ commented Jun 12, 2016

It appears that if a URL has the special characters of 20% to represent a space then the HTTP Binding fails.

The use case is the Google Maps Distance Matrix API that allows you to query the estimated travel time between two addresses.

This is my Item
Number TTW_Sonay "Sonay TTW [%s]" (GroupOutdoors) { http="<[https://maps.googleapis.com/maps/api/distancematrix/json?origins=OriginAddressHere&destinations=DestinationAddressHere&key=GoogleAPIKeyHere&language=en&departure_time=now:300000:JS(ttw_trafficTimesNumber.js)]"}

In my case the origin and distination addresses have spaces in them represented by 20%

This causes the error below.

2016-06-11 16:10:37.053 [ERROR] [.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.util.UnknownFormatConversionException: Conversion = 'R'
at java.util.Formatter$FormatSpecifier.conversion(Unknown Source) ~[na:1.8.0_60]
at java.util.Formatter$FormatSpecifier.(Unknown Source) ~[na:1.8.0_60]
at java.util.Formatter.parse(Unknown Source) ~[na:1.8.0_60]
at java.util.Formatter.format(Unknown Source) ~[na:1.8.0_60]
at java.util.Formatter.format(Unknown Source) ~[na:1.8.0_60]
at java.lang.String.format(Unknown Source) ~[na:1.8.0_60]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:136) ~[na:na]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]

With assistance from watou it appears the issue is with this line?
https://github.com/openhab/openhab/blob/master/bundles/binding/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBinding.java#L144

@9037568
Copy link
Contributor

9037568 commented Nov 4, 2016

Should be fixed with #4460.

@9037568 9037568 closed this as completed Nov 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants