XStream
  1. XStream
  2. XSTR-523

ISO8601DateConverter could not parse date for empty element

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.3
    • Fix Version/s: 1.x Maintenance
    • Component/s: Converters
    • Labels:
      None

      Description

      Hi,

      I've got a exception when XStream try to convert a empty element mapped with a Date.
      I use the ISO8601DateConverter.

      <product>
      <productId>10454</productId>
      <title>Playlist 1</title>
      <type>playlist</type>
      <summary/>
      <restrictedAccess>0</restrictedAccess>
      <media>
      <cover>XXXX</cover>
      </media>
      <artistList>
      <artists></artists>
      <offset>0</offset>
      <count>1</count>
      <total>1</total>
      </artistList>
      <label/>
      <releaseDate/>
      <flag>
      <topvente>99</topvente>
      <selection>99</selection>
      <new>99</new>
      </flag>
      </product>
      

      I've resolved this by overiding the fromString method

      @Override
          public Object fromString(String str) {
              if (StringUtils.isNotBlank(str))
                  return ((Calendar)super.fromString(str)).getTime();
              return null;
          }
      

      Damien

        People

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

          Dates

          • Created:
            Updated:
            Resolved: