Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.1
    • Component/s: wicket
    • Labels:
      None

      Description

      Please provide AttributeModifier#remove(String) method which deals with the internals in AttributeModifier.

      AttributeModifier has special constants : VALUELESS_ATTRIBUTE_ADD and VALUELESS_ATTRIBUTE_REMOVE which are checked with String#equals(). This disallows to set an attribute with their value. It will be better if they are created with 'new String(...)' and later checked by identity. They are static so there is no chance to be interned during deserialization.

      1. WICKET-3934.patch
        3 kB
        Attila Király

        Issue Links

          Activity

          Hide
          akiraly Attila Király added a comment -

          Wicket could use enums instead of strings to mark special attribute values. Attaching a patch to show what I mean.

          Imho in the current implementation the test o.a.w.AttributeModifierTest.appendSpecialAttribute() is not correct because it uses the special string "VA_REMOVE" as attribute name but that marker is not compared to the attribute name but to the attribute value in o.a.w.AttributeModifier.replaceAttributeValue(Component, ComponentTag).

          Show
          akiraly Attila Király added a comment - Wicket could use enums instead of strings to mark special attribute values. Attaching a patch to show what I mean. Imho in the current implementation the test o.a.w.AttributeModifierTest.appendSpecialAttribute() is not correct because it uses the special string "VA_REMOVE" as attribute name but that marker is not compared to the attribute name but to the attribute value in o.a.w.AttributeModifier.replaceAttributeValue(Component, ComponentTag).
          Hide
          mgrigorov Martin Grigorov added a comment -

          Reopen to consider the enum based solution and fix the test

          Show
          mgrigorov Martin Grigorov added a comment - Reopen to consider the enum based solution and fix the test
          Hide
          mgrigorov Martin Grigorov added a comment -

          This is implemented in another ticket

          Show
          mgrigorov Martin Grigorov added a comment - This is implemented in another ticket
          Hide
          mgrigorov Martin Grigorov added a comment -

          Oh, it was reopened. I forgot it ...

          Show
          mgrigorov Martin Grigorov added a comment - Oh, it was reopened. I forgot it ...
          Hide
          mgrigorov Martin Grigorov added a comment -

          Fixed the test.
          Will not change to use enum because it is API break.

          Show
          mgrigorov Martin Grigorov added a comment - Fixed the test. Will not change to use enum because it is API break.
          Hide
          mgrigorov Martin Grigorov added a comment -

          The suggested enum based solution has been applied to Wicket 8.x.
          Thank you, Attila Király!

          Show
          mgrigorov Martin Grigorov added a comment - The suggested enum based solution has been applied to Wicket 8.x. Thank you, Attila Király !

            People

            • Assignee:
              mgrigorov Martin Grigorov
              Reporter:
              mgrigorov Martin Grigorov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development