UrlBuilder reuse with setEvent
------------------------------
Key: STS-909
URL: http://www.stripesframework.org/jira/browse/STS-909
Project: Stripes
Issue Type: Improvement
Reporter: Alessio Stalla
Priority: Minor
Attachments: patch.txt
A single instance of UrlBuilder can not be reused multiple times if you set the
event to different values with setEvent. I.e., the following test doesn't pass:
UrlBuilder urlBuilder = new UrlBuilder(Locale.getDefault(), "", false);
urlBuilder.setEvent("first");
assertEquals("?first=", urlBuilder.toString());
urlBuilder.setEvent("second");
assertEquals("?second=", urlBuilder.toString()); //Here, urlBuilder.toString()
returns "?first="
The same pattern is at least partially supported with parameters because
calling addParameter clears the cached toString() result (although there is no
way of removing an added parameter).
The attached patch resolves the issue with a trivial change. There is no impact
on existing "correct" code; if there's code in the wild that works on the
assumption that calling setEvent() after a toString() does not actually change
the event, that code will break.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development