You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/06/19 14:17:03 UTC
[incubator-baremaps] branch 702-optional-byte-buffer created (now 82344de9)
This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a change to branch 702-optional-byte-buffer
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
at 82344de9 Fix null pointer exception
This branch includes the following new commits:
new 82344de9 Fix null pointer exception
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-baremaps] 01/01: Fix null pointer exception
Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a commit to branch 702-optional-byte-buffer
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit 82344de953e2be11b2b0a1a7e6039c43c245fbaf
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Mon Jun 19 16:16:45 2023 +0200
Fix null pointer exception
---
.../java/org/apache/baremaps/tilestore/TileCache.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/tilestore/TileCache.java b/baremaps-core/src/main/java/org/apache/baremaps/tilestore/TileCache.java
index 03610767..6e037790 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/tilestore/TileCache.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/tilestore/TileCache.java
@@ -51,19 +51,19 @@ public class TileCache implements TileStore {
/** {@inheritDoc} */
@Override
public ByteBuffer read(TileCoord tileCoord) throws TileStoreException {
- return cache.get(tileCoord, t -> {
+ var buffer = cache.get(tileCoord, t -> {
try {
- var buffer = tileStore.read(t);
- if (buffer == null) {
- return null;
- } else {
- return buffer;
- }
+ return tileStore.read(t);
} catch (TileStoreException e) {
logger.error("Unable to read the tile.", e);
return null;
}
- }).duplicate();
+ });
+ if (buffer == null) {
+ return null;
+ } else {
+ return buffer.duplicate();
+ }
}
/** {@inheritDoc} */