[
https://issues.apache.org/jira/browse/VELTOOLS-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nathan Bubna reassigned VELTOOLS-85:
------------------------------------
Assignee: Nathan Bubna
> DESCENDING order is not preserved in SortTool
> ---------------------------------------------
>
> Key: VELTOOLS-85
> URL: https://issues.apache.org/jira/browse/VELTOOLS-85
> Project: Velocity Tools
> Issue Type: Bug
> Components: GenericTools
> Affects Versions: 1.2, 1.3
> Environment: jdk1.5, jboss4.0.4, struts1.3.8, velocity-tools1.3
> Reporter: Tatyana
> Assignee: Nathan Bubna
>
> I have a property list for each page in my application that I store in the
> session. If the user sorts the column in DESCENDING order I add 'desc' to
> the property name and pass that list to the SortTool. The problem is that in
> the PropertiesComparator constructor, my list gets assigned to the member
> field and the member field is changed (the ':desc' is removed from the list).
> The result is the next time the user returns to the page with the column in
> DESCENDING order, the order is ASCENDING, which is not what I want. I want
> to preserve the user's selection.
> Here is the code in SortTool I'm referring to:
> public class PropertiesComparator implements Comparator
> {
> ...
> List properties;
> ...
> public PropertiesComparator(List properties)
> {
> this.properties = properties; //the member list is pointing
> to my list now
> ...
> int colonIndex = prop.indexOf(':');
> if (colonIndex != -1)
> {
> String sortType = prop.substring(colonIndex + 1);
> properties.set(i, prop.substring(0, colonIndex));
> //and here the 'desc' is removed
> I rebuild the velocity-tools.jar with the following changes to fix the
> problem:
> public PropertiesComparator(List propertiesList)
> {
> // I am copying my properties list to the member list instead of
> pointing to the same list
> properties = new ArrayList(propertiesList.size());
> properties.addAll(propertiesList);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]