Martin Desruisseaux created SIS-464:
---------------------------------------

             Summary: DataSet.getEnvelope() should return Optional<Envelope>
                 Key: SIS-464
                 URL: https://issues.apache.org/jira/browse/SIS-464
             Project: Spatial Information Systems
          Issue Type: Bug
          Components: Storage
    Affects Versions: 0.8
            Reporter: Martin Desruisseaux
            Assignee: Martin Desruisseaux
             Fix For: 1.0


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

{code:java}
Envelope getEnvelope() throws DataStoreException;
{code}

It should be:

{code:java}
Optional<Envelope> getEnvelope() throws DataStoreException;
{code}

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.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to