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 b9fe50961e1c80557e99e691f4139191647e0307
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Sat Jan 11 10:15:10 2020 +0100

    Conservatively fix CPG encoding to US_ASCII.
    Unwrap UncheckedIOException (or similar "exception wrappers") before to 
wrap them in ImagingOpException.
---
 .../sis-feature/src/main/java/org/apache/sis/image/ComputedImage.java | 3 ++-
 .../src/main/java/org/apache/sis/storage/shapefile/cpg/CpgFiles.java  | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/ComputedImage.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/ComputedImage.java
index f99775d..13a60f8 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ComputedImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ComputedImage.java
@@ -34,6 +34,7 @@ import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.util.collection.Cache;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ArraysExt;
+import org.apache.sis.util.Exceptions;
 import org.apache.sis.coverage.grid.GridExtent;     // For javadoc
 import org.apache.sis.internal.feature.Resources;
 
@@ -365,7 +366,7 @@ public abstract class ComputedImage extends PlanarImage {
                         tile = computeTile(tileX, tileY, previous);
                     } catch (Exception e) {
                         tile = null;
-                        error = e;
+                        error = Exceptions.unwrap(e);
                     }
                     if (marked) {
                         reference.endWrite(key, error == null);
diff --git 
a/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/cpg/CpgFiles.java
 
b/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/cpg/CpgFiles.java
index a448e59..8fa06f7 100644
--- 
a/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/cpg/CpgFiles.java
+++ 
b/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/cpg/CpgFiles.java
@@ -53,7 +53,7 @@ public final class CpgFiles extends Static {
      * @throws IOException if the file does not exist or cannot be read.
      */
     public static Charset read(final ReadableByteChannel in) throws 
IOException {
-        try (BufferedReader reader = new BufferedReader(new 
InputStreamReader(Channels.newInputStream(in), StandardCharsets.UTF_8))) {
+        try (BufferedReader reader = new BufferedReader(new 
InputStreamReader(Channels.newInputStream(in), StandardCharsets.US_ASCII))) {
             String line;
             while ((line = reader.readLine()) != null) {
                 if (!(line = line.trim()).isEmpty()) {
@@ -72,7 +72,7 @@ public final class CpgFiles extends Static {
      * @throws IOException if an error occurred while writing the file.
      */
     public static void write(final Charset cs, final Path file) throws 
IOException {
-        try (BufferedWriter writer = Files.newBufferedWriter(file, 
StandardCharsets.UTF_8)) {
+        try (BufferedWriter writer = Files.newBufferedWriter(file, 
StandardCharsets.US_ASCII)) {
             writer.write(cs.name());
         }
     }

Reply via email to