Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-128

NPE after marshal/unmarshal of com.sun.faces.util.LRUMap

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 1.3.7.GA, 2.0.0.Beta1
    • 1.3.6.GA
    • River
    • None

    Description

      Oddly, the same does not happen if a java.util.LinkedHashMap (the subclass of LRUMap).
      This can be reproduced via the following test:

      @Test
      public void test() throws Exception {
      MarshallerFactory factory = Marshalling.getMarshallerFactory("river", MarshallerFactory.class.getClassLoader());
      MarshallingConfiguration config = new MarshallingConfiguration();
      Map<String, Object[]> map = new com.sun.faces.util.LRUMap<String, Object[]>(15);
      map.put("a", new Object[]

      { 0, 1 }

      );
      ByteArrayOutputStream output = new ByteArrayOutputStream();
      Marshaller marshaller = factory.createMarshaller(config);
      marshaller.start(Marshalling.createByteOutput(output));
      marshaller.writeObject(map);
      marshaller.finish();
      marshaller.close();

      byte[] bytes = output.toByteArray();

      Unmarshaller unmarshaller = factory.createUnmarshaller(config);
      unmarshaller.start(Marshalling.createByteInput(new ByteArrayInputStream(bytes)));
      Map<String, Object[]> result = (Map<String, Object[]>) unmarshaller.readObject();
      unmarshaller.finish();
      unmarshaller.close();

      Assert.assertTrue(result.containsKey("a"));
      Assert.assertTrue(Arrays.equals(map.get("a"), result.get("a")));
      }

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              pferraro@redhat.com Paul Ferraro
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: