Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UriTemplate COMPOSITE_PREFIXES init problem #117

Closed
wonderfly opened this issue Jan 9, 2015 · 4 comments
Closed

UriTemplate COMPOSITE_PREFIXES init problem #117

wonderfly opened this issue Jan 9, 2015 · 4 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@wonderfly
Copy link
Contributor

From willem.s...@gmail.com on May 19, 2012 09:57:13

Version of google-http-java-client: 1.9.0-beta
Java environment: Java 6

There is a dangerous initialization problem in the class
com.google.api.client.http.UriTemplate. The COMPOSITE_PREFIXES map is not filled after classloading but only when the enum CompositeOutput is used. This means the first time getCompositeOutput is called, the map is still empty and only on line 190 the map is filled.

Testcase:

Map<String, Object> map = new HashMap<String, Object>();
map.put("id", Arrays.asList("a", "b", "c").iterator());

System.out.println("first:" + UriTemplate.expand("{/id_}", map, false));
System.out.println("second:" + UriTemplate.expand("{/id_}", map, false));

Output:
first:
second:/a/b/c How would you expect it to be fixed? Initialize map in a static {} block
The result of calling UriTemplate.expand twice should be the same

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=117

@wonderfly wonderfly added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. imported labels Jan 9, 2015
@wonderfly
Copy link
Contributor Author

From rmis...@google.com on May 21, 2012 04:17:03

Thank you for reporting this issue!

Labels: -Priority-Medium Priority-High Milestone-Version1.10.0

@wonderfly wonderfly self-assigned this Jan 9, 2015
@wonderfly
Copy link
Contributor Author

From rmis...@google.com on May 21, 2012 07:25:08

http://codereview.appspot.com/6208085/

Status: Started

@wonderfly
Copy link
Contributor Author

From rmis...@google.com on May 21, 2012 09:29:17

Labels: Component-HTTP

@wonderfly
Copy link
Contributor Author

From rmis...@google.com on May 22, 2012 13:30:38

Status: Fixed

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants