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 2020/11/03 22:54:52 UTC

[sis] 01/04: Paranoiac check in case the attribute value is already a list.

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 5c03a79aea0337fb02e98bd14c11d246637c9d5e
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Oct 29 15:34:53 2020 +0100

    Paranoiac check in case the attribute value is already a list.
---
 .../org/apache/sis/internal/netcdf/impl/VariableInfo.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
index f067fc3..fc30c71 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
@@ -260,11 +260,16 @@ final class VariableInfo extends Variable implements Comparable<VariableInfo> {
 
     /**
      * Splits a space-separated attribute value into an array of strings.
+     * If the attribute is a list of numbers, it will be left unchanged.
+     * (should not happen, but we are paranoiac)
      */
-    private void split(final String attribute) {
-        final CharSequence[] values = getAttributeAsStrings(attribute, ' ');
+    private void split(final String attributeName) {
+        final CharSequence[] values = getAttributeAsStrings(attributeName, ' ');
         if (values != null) {
-            attributes.put(attribute, values);
+            final Object previous = attributes.put(attributeName, values);
+            if (previous instanceof Vector) {
+                attributes.put(attributeName, previous);
+            }
         }
     }