This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new fcb4b84  Fix a NullPointerException occurring during execution of 
Convention.isApplicableTo(Decoder).
fcb4b84 is described below

commit fcb4b8484f580f579c29fba300ff5d481edf6ff6
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu Feb 21 16:54:47 2019 +0100

    Fix a NullPointerException occurring during execution of 
Convention.isApplicableTo(Decoder).
---
 .../src/main/java/org/apache/sis/internal/netcdf/Convention.java       | 2 +-
 .../src/main/java/org/apache/sis/internal/netcdf/Decoder.java          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
index 5f0d9e3..631636c 100644
--- 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
+++ 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Convention.java
@@ -63,7 +63,7 @@ public class Convention {
     /**
      * The convention to use when no specific conventions were found.
      */
-    private static final Convention DEFAULT = new Convention();
+    static final Convention DEFAULT = new Convention();
 
     /**
      * Names of groups where to search for metadata, in precedence order.
diff --git 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
index d4d0cc4..ffc4480 100644
--- 
a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
+++ 
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
@@ -131,7 +131,8 @@ public abstract class Decoder extends 
ReferencingFactoryContainer implements Clo
      * @return conventions to apply.
      */
     public final Convention convention() {
-        return convention;
+        // Convention are still null if this method is invoked from 
Convention.isApplicableTo(Decoder).
+        return (convention != null) ? convention : Convention.DEFAULT;
     }
 
     /**

Reply via email to