I reverted #remove(String) and added #remove(String, String...)
#remove(String) will be removed with next major version of Wicket

On Tue, Aug 30, 2011 at 8:06 AM, Frank van Lankvelt
<[email protected]> wrote:
> On 29 aug. 2011, at 22:30, Martin Grigorov <[email protected]> wrote:
>
>> On Mon, Aug 29, 2011 at 10:16 PM, Bruno Borges <[email protected]> 
>> wrote:
>>> Z version increases are always seen as bug fixes... Without *any* API break.
>> There is no API break in this commit.
>> The change is API compatible, but binary incompatible, so you cant
>> just put the new wicket-request.jar in your .war#WEB-INF/lib/ and go
>> without recompiling.
>>>
>>> Bugs may appear and one should not just update the jar and move to
>>> production, but things like class not found, no such method and so on, are
>>> simply not acceptable.
>>>
>>> A user may just update the jar that states a bug fix in its changelog, runs
>>> it in development (without recompiling) to check if the bug is really fixed
>>> in one particular use case and then move to production.
>> I truly believe there are no such developers that take versionX of
>> their product, put a new .jar in it and release it as versionY without
>> adding their own feature, fixing their own bug or run their tests. All
>> of these involve recompiling.
>>
> A use-case would be having a core product with a number of plugins.
> The core product, that bundles wicket, will indeed be recompiled.
> However, the plugins will not.  They do expect binary backwards
> conpatibility between micro releases.  Being unable to bump wicket
> micro versions for the core product would then be a problem.
>
> Cheers, Frank
>
>> I personally wasn't aware of PageParameters#remove(String) before this
>> ticket so I believe it is not wildly used.
>> But if you think that it should be reverted/reimplemented then I will do it.
>>>
>>>
>>> *Bruno Borges*
>>> (21) 7672-7099
>>> *www.brunoborges.com*
>>>
>>>
>>>
>>> On Mon, Aug 29, 2011 at 4:46 PM, Martijn Dashorst <
>>> [email protected]> wrote:
>>>
>>>> The issue is not the new logic, but rather the change in signature.
>>>> PageParameters is not a rarely used class.
>>>>
>>>> As for not putting it into production with an existing war... I can
>>>> see enough reason not to have to recompile a whole codebase for a
>>>> 1.5.1 upgrade. Instead just upgrade the jar, repackage and deploy to
>>>> your test server. Boom, doesn't work with nosuchmethod error.
>>>>
>>>> Martijn
>>>>
>>>> On Mon, Aug 29, 2011 at 9:37 PM, Martin Grigorov <[email protected]>
>>>> wrote:
>>>>> I mean remove the new logic in this method, not the whole method
>>>>>
>>>>> On Mon, Aug 29, 2011 at 9:37 PM, Martin Grigorov <[email protected]>
>>>> wrote:
>>>>>> I would rather remove this method altogether if it is really a problem.
>>>>>> But who just puts a new .jar in an existing .war and goes in
>>>>>> production ? This is toooo brave .. I doubt there are such companies
>>>>>>
>>>>>> On Mon, Aug 29, 2011 at 9:30 PM, Martijn Dashorst
>>>>>> <[email protected]> wrote:
>>>>>>> AFAIK this requires a recompile for folks upgrading from 1.5-RC7 to
>>>>>>> 1.5-RC8 (or 1.5.0 to 1.5.1). Not very handy.
>>>>>>>
>>>>>>> The signature goes from:
>>>>>>>
>>>>>>>    PageParameters#remove(String)
>>>>>>> to
>>>>>>>    PageParameters#remove(String, String[])
>>>>>>>
>>>>>>> IMO it is better to add the varargs method, or if it isn't compatible,
>>>>>>> add a method with signature:
>>>>>>>    remove(String, String, String...)
>>>>>>>
>>>>>>> Martijn
>>>>>>>
>>>>>>> On Mon, Aug 29, 2011 at 2:48 PM,  <[email protected]> wrote:
>>>>>>>> Author: mgrigorov
>>>>>>>> Date: Mon Aug 29 12:48:07 2011
>>>>>>>> New Revision: 1162772
>>>>>>>>
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1162772&view=rev
>>>>>>>> Log:
>>>>>>>> WICKET-3938 Impossible to remove particular key-value from
>>>> PageParameters
>>>>>>>>
>>>>>>>>
>>>>>>>> Modified:
>>>>>>>>
>>>>  wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java
>>>>>>>>
>>>>  wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java
>>>>>>>>
>>>>  wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/mapper/parameter/PageParametersTest.java
>>>>>>>>
>>>>>>>> Modified:
>>>> wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java
>>>>>>>> URL:
>>>> http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java?rev=1162772&r1=1162771&r2=1162772&view=diff
>>>>>>>>
>>>> ==============================================================================
>>>>>>>> ---
>>>> wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java
>>>> (original)
>>>>>>>> +++
>>>> wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java
>>>> Mon Aug 29 12:48:07 2011
>>>>>>>> @@ -72,9 +72,13 @@ public interface INamedParameters
>>>>>>>>         * Removes named parameter with given name.
>>>>>>>>         *
>>>>>>>>         * @param name
>>>>>>>> +        *            the name of the parameter to remove
>>>>>>>> +        * @param values
>>>>>>>> +        *            values used as criteria. The parameter will be
>>>> removed only if its value is equal
>>>>>>>> +        *            to any of the criteria.
>>>>>>>>         * @return this
>>>>>>>>         */
>>>>>>>> -       INamedParameters remove(final String name);
>>>>>>>> +       INamedParameters remove(final String name, String... values);
>>>>>>>>
>>>>>>>>        /**
>>>>>>>>         * Adds value to named parameter with given name.
>>>>>>>>
>>>>>>>> Modified:
>>>> wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java
>>>>>>>> URL:
>>>> http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java?rev=1162772&r1=1162771&r2=1162772&view=diff
>>>>>>>>
>>>> ==============================================================================
>>>>>>>> ---
>>>> wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java
>>>> (original)
>>>>>>>> +++
>>>> wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java
>>>> Mon Aug 29 12:48:07 2011
>>>>>>>> @@ -392,7 +392,7 @@ public class PageParameters implements I
>>>>>>>>        /**
>>>>>>>>         * @see
>>>> org.apache.wicket.request.mapper.parameter.INamedParameters#remove(java.lang.String)
>>>>>>>>         */
>>>>>>>> -       public PageParameters remove(final String name)
>>>>>>>> +       public PageParameters remove(final String name, final
>>>> String... values)
>>>>>>>>        {
>>>>>>>>                Args.notNull(name, "name");
>>>>>>>>
>>>>>>>> @@ -403,7 +403,21 @@ public class PageParameters implements I
>>>>>>>>                                Entry e = i.next();
>>>>>>>>                                if (e.key.equals(name))
>>>>>>>>                                {
>>>>>>>> -                                       i.remove();
>>>>>>>> +                                       if (values != null &&
>>>> values.length > 0)
>>>>>>>> +                                       {
>>>>>>>> +                                               for (String value :
>>>> values)
>>>>>>>> +                                               {
>>>>>>>> +                                                       if
>>>> (e.value.equals(value))
>>>>>>>> +                                                       {
>>>>>>>> +
>>>> i.remove();
>>>>>>>> +                                                               break;
>>>>>>>> +                                                       }
>>>>>>>> +                                               }
>>>>>>>> +                                       }
>>>>>>>> +                                       else
>>>>>>>> +                                       {
>>>>>>>> +                                               i.remove();
>>>>>>>> +                                       }
>>>>>>>>                                }
>>>>>>>>                        }
>>>>>>>>                }
>>>>>>>>
>>>>>>>> Modified:
>>>> wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/mapper/parameter/PageParametersTest.java
>>>>>>>> URL:
>>>> http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/mapper/parameter/PageParametersTest.java?rev=1162772&r1=1162771&r2=1162772&view=diff
>>>>>>>>
>>>> ==============================================================================
>>>>>>>> ---
>>>> wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/mapper/parameter/PageParametersTest.java
>>>> (original)
>>>>>>>> +++
>>>> wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/mapper/parameter/PageParametersTest.java
>>>> Mon Aug 29 12:48:07 2011
>>>>>>>> @@ -109,6 +109,8 @@ public class PageParametersTest extends
>>>>>>>>
>>>>>>>>        /**
>>>>>>>>         * https://issues.apache.org/jira/browse/WICKET-3938
>>>>>>>> +        *
>>>>>>>> +        * Remove the parameter by its name
>>>>>>>>         */
>>>>>>>>        @Test
>>>>>>>>        public void removeParameters()
>>>>>>>> @@ -123,4 +125,21 @@ public class PageParametersTest extends
>>>>>>>>                parameters.remove("named2");
>>>>>>>>                assertTrue(parameters.isEmpty());
>>>>>>>>        }
>>>>>>>> +
>>>>>>>> +       /**
>>>>>>>> +        * https://issues.apache.org/jira/browse/WICKET-3938
>>>>>>>> +        *
>>>>>>>> +        * Remove the parameter by its name only if its value is equal
>>>> to the criteria
>>>>>>>> +        */
>>>>>>>> +       @Test
>>>>>>>> +       public void removeParametersByValue()
>>>>>>>> +       {
>>>>>>>> +               PageParameters parameters = new
>>>> PageParameters().add("named1", "value1").add("named1",
>>>>>>>> +                       "value2");
>>>>>>>> +
>>>>>>>> +               assertEquals(2, parameters.getAllNamed().size());
>>>>>>>> +
>>>>>>>> +               parameters.remove("named1", "value1");
>>>>>>>> +               assertEquals("value2",
>>>> parameters.get("named1").toString());
>>>>>>>> +       }
>>>>>>>>  }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Martin Grigorov
>>>>>> jWeekend
>>>>>> Training, Consulting, Development
>>>>>> http://jWeekend.com
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Martin Grigorov
>>>>> jWeekend
>>>>> Training, Consulting, Development
>>>>> http://jWeekend.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>>
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Reply via email to