CXF
  1. CXF
  2. CXF-4280

case insensitive MetadataMap keyset

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.3
    • Fix Version/s: 2.3.11, 2.4.8, 2.5.4, 2.6.1
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      while working on TCK for openejb/tomee we needed to do it:

      public class PatchedMetadataMap extends MetadataMap<String, String> {
      public PatchedMetadataMap(Map<String, List<String>> store, boolean ro, boolean ci)

      { super(store, ro, ci); }

      public Set<String> keySet()

      { Set<String> set = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); set.addAll(super.keySet()); return set; }

      }

      any way to merge it in cxf?

        Activity

        Romain Manni-Bucau created issue -
        Hide
        Sergey Beryozkin added a comment -

        Hi, sure, can you please type some test code here which exposes the issue this fix will address ?
        I'm trying to fail one of the existing MetadataTests by using different map operations and can not

        I can only think of the following:

         // create a case-insensitive map
         MetadataMap<String, Object> m = new MetadataMap<String, Object>(false, true);
         m.add("Baz", "bar");
         assertEquals("bar", m.getFirst("Baz"));
         assertEquals("bar", m.getFirst("baz"));
        
         // checks the key set itself
         Set<String> keys = m.keySet();
         assertEquals(1, keys.size());
         assertTrue(keys.contains("Baz"));
         // this one currently fails
         assertTrue(keys.contains("baz")); 
        

        Do you test the key set itself or do you get some application test due to the keySet() not use a case insensitive order on the trunk ?

        Show
        Sergey Beryozkin added a comment - Hi, sure, can you please type some test code here which exposes the issue this fix will address ? I'm trying to fail one of the existing MetadataTests by using different map operations and can not I can only think of the following: // create a case -insensitive map MetadataMap< String , Object > m = new MetadataMap< String , Object >( false , true ); m.add( "Baz" , "bar" ); assertEquals( "bar" , m.getFirst( "Baz" )); assertEquals( "bar" , m.getFirst( "baz" )); // checks the key set itself Set< String > keys = m.keySet(); assertEquals(1, keys.size()); assertTrue(keys.contains( "Baz" )); // this one currently fails assertTrue(keys.contains( "baz" )); Do you test the key set itself or do you get some application test due to the keySet() not use a case insensitive order on the trunk ?
        Hide
        Romain Manni-Bucau added a comment -

        if i remind correctly if the header key is tested in lowercase it fails because it is stored with some upper case ("Content-Type").

        Show
        Romain Manni-Bucau added a comment - if i remind correctly if the header key is tested in lowercase it fails because it is stored with some upper case ("Content-Type").
        Hide
        Sergey Beryozkin added a comment -

        Hi Romain, any chance you can offer a link to the code ? I have a couple of tests retrieving HttpHeader parameters in a case-insensitive way and it does seem to work. I think MetadataMap does need to be enhanced but I think it is only required on certain paths and I'm trying identify them with a failing test

        Show
        Sergey Beryozkin added a comment - Hi Romain, any chance you can offer a link to the code ? I have a couple of tests retrieving HttpHeader parameters in a case-insensitive way and it does seem to work. I think MetadataMap does need to be enhanced but I think it is only required on certain paths and I'm trying identify them with a failing test
        Hide
        Romain Manni-Bucau added a comment -

        ok reproduced it your test is good for our failing one. We use keyset().

        Show
        Romain Manni-Bucau added a comment - ok reproduced it your test is good for our failing one. We use keyset().
        Sergey Beryozkin made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Sergey Beryozkin [ sergey_beryozkin ]
        Fix Version/s 2.6.1 [ 12320746 ]
        Fix Version/s 2.5.4 [ 12320747 ]
        Fix Version/s 2.4.8 [ 12320748 ]
        Fix Version/s 2.3.11 [ 12320749 ]
        Resolution Fixed [ 1 ]
        Daniel Kulp made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Sergey Beryozkin
            Reporter:
            Romain Manni-Bucau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development