Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-15312

Hot Rod client might receive wrong types from server with text/plain media type

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 15.0.0.Dev04
    • Hot Rod
    • None

    Description

      Configuring a server with text/plain types might lead to the client receiving the wrong types. Since text/plain has no notion of object types, the (un)marshaling might succeed but leave with a different object type.

      A simple reproducer, creating a server with text/plain for the values:

      WrongTypeReproducer
            RemoteCacheManager rcm = ...; // Create remote cache manager.
            RemoteCache<Integer, Integer> remote = rcm.getCache();
            remote.put(1, 1);
            Object r1 = remote.get(1);
            assertThat(r1).isEqualTo(1);
      

      This will fail with:

      org.opentest4j.AssertionFailedError: 
      expected: 1
       but was: "1"
      

      Investigation is needed to see if it is possible and a solution. Otherwise, we can document the limitation. The conversion to text eliminates all notions of types, which might be hard to retrieve later without hints.

      Changing the conversion on the server would break compatibility, as the hash would change, and keys wouldn't be found anymore. So, a likely solution would be updating the client side to execute the conversion between object types and let the server handle the conversion between media types.

      Attachments

        Activity

          People

            rh-ee-jbolina Jose Bolina
            rh-ee-jbolina Jose Bolina
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: