sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [sis] branch geoapi-4.0 updated: BufferedGridCoverage : fix buffer size verification, number of banks was ignored
Date Thu, 19 Mar 2020 16:16:49 GMT
This is an automated email from the ASF dual-hosted git repository.

jsorel pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new aef299e  BufferedGridCoverage : fix buffer size verification, number of banks was
ignored
aef299e is described below

commit aef299ece96a69dfdaecbaf5f067665214702c8e
Author: jsorel <johann.sorel@geomatys.com>
AuthorDate: Thu Mar 19 17:16:27 2020 +0100

    BufferedGridCoverage : fix buffer size verification, number of banks was ignored
---
 .../org/apache/sis/internal/coverage/j2d/BufferedGridCoverage.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/BufferedGridCoverage.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/BufferedGridCoverage.java
index 061c079..0f1a68a 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/BufferedGridCoverage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/BufferedGridCoverage.java
@@ -73,8 +73,9 @@ public class BufferedGridCoverage extends GridCoverage {
         for (int i = 1; i <extent.getDimension(); i++) {
             expectedSize *= extent.getSize(i);
         }
-        if (data.getSize() < expectedSize) {
-            throw new IllegalGridGeometryException("Expecting a buffer size of at least "
+ expectedSize + " to contain all samples from given grid geometry, but buffer is only " +data.getSize());
+        long buffersize = Math.multiplyExact(data.getSize(), data.getNumBanks());
+        if (buffersize < expectedSize) {
+            throw new IllegalGridGeometryException("Expecting a buffer size of at least "
+ expectedSize + " to contain all samples from given grid geometry, but buffer is only " +
buffersize);
         }
     }
 


Mime
View raw message