Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-125

ModifiableMetadata.nonNullCollection(...) should determine more accuratly if the metadata object is being marshalled

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.1
    • None
    • Metadata
    • None

    Description

      Despite its name, the ModifiableMetadata.nonNullCollection(...) method may return null in the special case of XML marshalling if and only if the marshalled element is optional. This is a hack for preventing JAXB to create empty nodes for empty properties. However in current implementation, the decision to return null or not is set by a thread-local flag, which apply to the ModifiableMetadata instances being marshalled in that particular thread. This approach does not work well when the user provides its own metadata subclass which create new elements in the collection on the fly.

      We may need to make the ModifiableMetadata.canReturnNull() method more accurate in order to not only use a thread-local flag, but also check for the particular metadata instance being marshalled. This would require storing somewhere a reference to the element being marshalled, and cleaning that reference after the marshalling of that particular element finished.

      Attachments

        Activity

          People

            Unassigned Unassigned
            desruisseaux Martin Desruisseaux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: