XStream
  1. XStream
  2. XSTR-239

Xstream fails to deserialize elements in a CGLIB based HashMap proxy

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None

      Description

      XStream seems to have trouble with CGLIB proxies based on real classes. See following effect for a proxy extending HashMap, where the ObjectName element gets lost, that is stored in the HashMap of the DelegatingHandler:

      public class DelegatingHandler implements InvocationHandler, Serializable {
      private final Object delegate;

      public DelegatingHandler(Object delegate)

      { this.delegate = delegate; }

      public Object invoke(Object obj, Method method, Object[] args) throws Throwable

      { return method.invoke(delegate, args); }

      }

      /**

      • @throws Exception
        */
        public void testCGLib() throws Exception
        Unknown macro: { final Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(HashMap.class); enhancer.setInterfaces(new Class[]{Map.class}); enhancer.setCallback(new DelegatingHandler(new HashMap())); final Map orig = (Map)enhancer.create(); orig.put("ObjectName", new ObjectName("domain}

        Issue Links

          People

          • Assignee:
            Unassigned
            Reporter:
            Jörg Schaible
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: