sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1803833 - in /sis/branches/JDK8/core: sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
Date Wed, 02 Aug 2017 15:37:44 GMT
Author: desruisseaux
Date: Wed Aug  2 15:37:43 2017
New Revision: 1803833

URL: http://svn.apache.org/viewvc?rev=1803833&view=rev
Log:
Make FeatureFormat robust to signaling NaN.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1803833&r1=1803832&r2=1803833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] Wed Aug  2 15:37:43 2017
@@ -39,9 +39,11 @@ import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.system.Modules;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.math.MathFunctions;
 
@@ -525,8 +527,13 @@ public class FeatureFormat extends Tabul
                                                 t.setLength(0);
                                                 t.append("NaN");
                                             }
-                                            final int n = MathFunctions.toNanOrdinal(f);
-                                            if (n > 0) buffer.append(" #").append(n);
+                                            try {
+                                                final int n = MathFunctions.toNanOrdinal(f);
+                                                if (n > 0) buffer.append(" #").append(n);
+                                            } catch (IllegalArgumentException e) {
+                                                // May happen if the NaN is a signaling NaN
instead than a quiet NaN.
+                                                Logging.recoverableException(Logging.getLogger(Modules.FEATURE),
FeatureFormat.class, "format", e);
+                                            }
                                         }
                                     }
                                     value = t;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java?rev=1803833&r1=1803832&r2=1803833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
[UTF-8] Wed Aug  2 15:37:43 2017
@@ -60,6 +60,11 @@ public final class Modules {
     /**
      * The {@value} module name.
      */
+    public static final String FEATURE = "org.apache.sis.feature";
+
+    /**
+     * The {@value} module name.
+     */
     public static final String STORAGE = "org.apache.sis.storage";
 
     /**



Mime
View raw message