sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1749889 - in /sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice: CalcAddins.java ReferencingFunctions.java
Date Thu, 23 Jun 2016 13:29:00 GMT
Author: desruisseaux
Date: Thu Jun 23 13:28:59 2016
New Revision: 1749889

URL: http://svn.apache.org/viewvc?rev=1749889&view=rev
Log:
Returns an empty array instead of NaN values if the add-in can not compute values.

Modified:
    sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
    sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java

Modified: sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java?rev=1749889&r1=1749888&r2=1749889&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
[UTF-8] (original)
+++ sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
[UTF-8] Thu Jun 23 13:28:59 2016
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.openoffice;
 
-import java.util.Arrays;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.logging.LogRecord;
@@ -185,24 +184,6 @@ public abstract class CalcAddins extends
     }
 
     /**
-     * Returns a table filled with {@link Double#NaN} values.
-     * This method is invoked when an operation failed for a whole table.
-     *
-     * @param  rows  the number of rows.
-     * @param  cols  the number of columns.
-     * @return A table of the given size filled with NaN values.
-     */
-    static double[][] getFailure(final int rows, final int cols) {
-        final double[][] dummy = new double[rows][];
-        for (int i=0; i<rows; i++) {
-            final double[] row = new double[cols];
-            Arrays.fill(row, Double.NaN);
-            dummy[i] = row;
-        }
-        return dummy;
-    }
-
-    /**
      * Reports an exception. This is used if an exception occurred in a method that can not
return
      * a {@link String} instance. This method logs the stack trace at {@link Level#WARNING}.
      *

Modified: sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java?rev=1749889&r1=1749888&r2=1749889&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
[UTF-8] (original)
+++ sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
[UTF-8] Thu Jun 23 13:28:59 2016
@@ -277,7 +277,7 @@ public class ReferencingFunctions extend
             }
         }
         if (area == null) {
-            return getFailure(2,2);
+            return new double[][] {};
         }
         return new double[][] {
             new double[] {area.getNorthBoundLatitude(), area.getWestBoundLongitude()},
@@ -363,7 +363,7 @@ public class ReferencingFunctions extend
             result  = tr.transform(points);
             warning = tr.warning;
         } catch (Exception exception) {
-            result  = getFailure(points.length, 2);
+            result  = new double[][] {};
             warning = exception;
         }
         if (warning != null) {
@@ -382,14 +382,12 @@ public class ReferencingFunctions extend
      */
     @Override
     public double[][] transformEnvelope(String sourceCRS, String targetCRS, double[][] envelope)
{
-        if (envelope == null || envelope.length == 0) {
-            return new double[][] {};
-        } else try {
+        if (envelope != null && envelope.length != 0) try {
             return new Transformer(this, getCRS(sourceCRS), targetCRS, envelope).transformEnvelope(envelope);
         } catch (Exception exception) {
             reportException("transformEnvelope", exception);
-            return getFailure(envelope.length, 2);
         }
+        return new double[][] {};
     }
 
     /**



Mime
View raw message