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

DataSet.getEnvelope() should return Optional<Envelope>

    XMLWordPrintableJSON

    Details

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

      Description

      The org.apache.sis.storage.DataSet interface contains the following method:

      Envelope getEnvelope() throws DataStoreException;
      

      It should be:

      Optional<Envelope> getEnvelope() throws DataStoreException;
      

      The javadoc was saying that this envelope should not be null, but may nevertheless be null is some circumstances. For example the envelope may be too costly to compute if it would require to scan all features in a dataset. The danger is that users will assume that the envelope will never be null for practical purposes, which is a dangerous assumptions. In another project using SIS, we found that this assumption was one significant cause of NullPointerException. We propose to declare the envelope as Optional for making clear that it may be absent.

      Note that this is an incompatible API changes. We hope that DataSet.getEnvelope() is not yet used too widely.

        Attachments

          Activity

            People

            • Assignee:
              desruisseaux Martin Desruisseaux
              Reporter:
              desruisseaux Martin Desruisseaux
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: