This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch fix-stream-exceptions
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git


The following commit(s) were added to refs/heads/fix-stream-exceptions by this 
push:
     new 95a28b04 Properly handle InterruptedException
95a28b04 is described below

commit 95a28b04d2eb3005c8cbfacad0af67ff3eeea412
Author: Bertil Chapuis <[email protected]>
AuthorDate: Sat Dec 2 21:31:34 2023 +0100

    Properly handle InterruptedException
---
 .../src/main/java/org/apache/baremaps/stream/StreamUtils.java        | 5 ++++-
 .../org/apache/baremaps/tilestore/postgres/PostgresTileStore.java    | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/stream/StreamUtils.java 
b/baremaps-core/src/main/java/org/apache/baremaps/stream/StreamUtils.java
index 707fd198..31b53722 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/stream/StreamUtils.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/stream/StreamUtils.java
@@ -151,7 +151,10 @@ public class StreamUtils {
     return buffer(asyncStream, completionOrder, bufferSize).map(f -> {
       try {
         return f.get();
-      } catch (InterruptedException | ExecutionException e) {
+      } catch (ExecutionException e) {
+        throw new StreamException(e);
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
         throw new StreamException(e);
       }
     });
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresTileStore.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresTileStore.java
index e9d8984e..8aa412a6 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresTileStore.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresTileStore.java
@@ -163,7 +163,8 @@ public class PostgresTileStore implements TileStore {
               .replace("?", "??")
               .replace("$zoom", String.valueOf(zoom));
           var querySqlWithParams = String.format(
-              "SELECT ST_AsMVTGeom(t.geom, ST_TileEnvelope(?, ?, ?)) AS geom, 
t.tags - 'id' AS tags, t.id AS id " +
+              "SELECT ST_AsMVTGeom(t.geom, ST_TileEnvelope(?, ?, ?)) AS geom, 
t.tags - 'id' AS tags, t.id AS id "
+                  +
                   "FROM (%s) AS t WHERE t.geom IS NOT NULL AND t.geom && 
ST_TileEnvelope(?, ?, ?, margin => (64.0/4096))",
               querySql);
           layerSql.append(querySqlWithParams);

Reply via email to