webdav-jaxrs
  1. webdav-jaxrs
  2. WEBDAV_JAXRS-32

Sporadically CreationDate unmarshals as null instead of "empty" instance

    Details

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

      Description

      Sometimes it happens that JAXB unmarshals <creationdate/> as null instead of "empty" CreationDate instance.

        Activity

        Hide
        mkarg added a comment -

        Cause: JAXB sometimes wants to invoke setter with empty string instead of null. The reason for that could not be found out. The DateTime parser used is not prepared for empty strings to parse and throws a RuntimeException. Unfortunately JAXB does not forward that exception but simply silently fails.

        Solution: Fixed the DateTime parser to correctly throw ParseException, which JAXB will effectively forward. Checking for empty string and handling it as null. Effectively the latter works around JAXB's strange behaviour, while the first is just for correctness.

        Show
        mkarg added a comment - Cause: JAXB sometimes wants to invoke setter with empty string instead of null. The reason for that could not be found out. The DateTime parser used is not prepared for empty strings to parse and throws a RuntimeException. Unfortunately JAXB does not forward that exception but simply silently fails. Solution: Fixed the DateTime parser to correctly throw ParseException, which JAXB will effectively forward. Checking for empty string and handling it as null. Effectively the latter works around JAXB's strange behaviour, while the first is just for correctness.
        Hide
        mkarg added a comment -

        Fixed in 1.2-SNAPSHOT

        Show
        mkarg added a comment - Fixed in 1.2-SNAPSHOT
        Hide
        mkarg added a comment -

        The same happens with GetContentLength. Apparently JAXB sometimes wants to inject an empty String into a Long field, and fails with that.

        Worked around this issue in 1.2-SNAPSHOT by using PROPERTY injection instead of FIELD injection.

        Show
        mkarg added a comment - The same happens with GetContentLength. Apparently JAXB sometimes wants to inject an empty String into a Long field, and fails with that. Worked around this issue in 1.2-SNAPSHOT by using PROPERTY injection instead of FIELD injection.
        Hide
        mkarg added a comment -

        The same happens with GetLastModified.

        Worked around this issue in 1.2-SNAPSHOT by using the same workaround as for CreationDate.

        Show
        mkarg added a comment - The same happens with GetLastModified. Worked around this issue in 1.2-SNAPSHOT by using the same workaround as for CreationDate.

          People

          • Assignee:
            mkarg
            Reporter:
            mkarg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: