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 a54ead13f381876c93e580182de34aa7e6f4da47
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Wed Feb 16 12:14:23 2022 +0100

    Fix a possible synchronization hole.
---
 .../main/java/org/apache/sis/filter/LeafExpression.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java 
b/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java
index c561d1c..fee716d 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java
@@ -137,12 +137,15 @@ abstract class LeafExpression<R,V> extends Node 
implements FeatureExpression<R,V
         @Override
         public PropertyTypeBuilder expectedType(FeatureType ignored, final 
FeatureTypeBuilder addTo) {
             final Class<?> valueType = getValueClass();
-            AttributeType<?> propertyType = TYPES.get(valueType);
-            if (propertyType == null) {
-                final Class<?> standardType = 
Classes.getStandardType(valueType);
-                propertyType = TYPES.computeIfAbsent(standardType, 
Literal::newType);
-                if (valueType != standardType) {
-                    TYPES.put(valueType, propertyType);
+            AttributeType<?> propertyType;
+            synchronized (TYPES) {
+                propertyType = TYPES.get(valueType);
+                if (propertyType == null) {
+                    final Class<?> standardType = 
Classes.getStandardType(valueType);
+                    propertyType = TYPES.computeIfAbsent(standardType, 
Literal::newType);
+                    if (valueType != standardType) {
+                        TYPES.put(valueType, propertyType);
+                    }
                 }
             }
             return addTo.addProperty(propertyType);

Reply via email to