XStream
  1. XStream
  2. XSTR-18

Empty list produces a single </listName> instead of nothing

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      For example i have these classes and interfaces:

      public interface Payload {
      public String getType();
      }

      public class Session implements Payload {
      private String startTime;
      private String entTime;
      private List events = new ArrayList();
      ....
      }

      public class Message {
      private Payload payload;
      ...
      public String toXML()

      { XStream xstream = new XStream(); .... xstream.alias("message", Message.class); xstream.alias("payload", Payload.class); xstream.alias("event", EventLog.class); xstream.alias("session", Session.class); return xstream.toXML(this); }

      }

      when i use the method, if the ArrayList is empty, it produces a single </events> in the xml string where the events are supposed to be instead of producing nothing for the events. i know xstream has problem with inheritance but i am not sure if this is the case.

        People

        • Assignee:
          Unassigned
          Reporter:
          Ahmet A. Akin
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: