You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2019/04/30 16:32:18 UTC

[sis] 01/02: Fix a thread-safety hole.

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

commit 1f0fbb98f1872b7973d61d63e22232a9ff47b022
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Apr 30 17:29:25 2019 +0200

    Fix a thread-safety hole.
---
 .../src/main/java/org/apache/sis/metadata/PropertyInformation.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
index 32e6f07..ea98aa9 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
@@ -116,7 +116,7 @@ final class PropertyInformation<E> extends SimpleIdentifier           // Impleme
      *
      * @see #getDomainValue()
      */
-    private Object domainValue;
+    private volatile Object domainValue;
 
     /**
      * Creates a new {@code PropertyInformation} instance from the annotations on the given getter method.
@@ -286,6 +286,7 @@ final class PropertyInformation<E> extends SimpleIdentifier           // Impleme
         if (domain != null) {
             if (!(domain instanceof DomainRange)) {
                 try {
+                    // Not a big deal if we create two instances of that in two concurrent threads.
                     domain = new DomainRange(elementType, (ValueRange) domain);
                 } catch (IllegalArgumentException e) {
                     /*