You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by js...@apache.org on 2025/05/07 06:54:28 UTC
(sis) branch geoapi-4.0 updated: Resolve shapefile sibling files without going trought parent path which may be null
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 12d68ec5d1 Resolve shapefile sibling files without going trought parent path which may be null
12d68ec5d1 is described below
commit 12d68ec5d1a590513f63d7629128befc1b748209
Author: jsorel <jo...@geomatys.com>
AuthorDate: Wed May 7 08:53:12 2025 +0200
Resolve shapefile sibling files without going trought parent path which may be null
---
.../org/apache/sis/storage/shapefile/ShapefileStore.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
index 8589e3280a..326b827a8f 100644
--- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
+++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
@@ -929,7 +929,7 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe
*/
public Path getShx(boolean create) {
if (create && shxFile == null) {
- return shpFile.getParent().resolve(baseName + "." + (baseUpper ? "SHX" : "shx"));
+ return shpFile.resolveSibling(baseName + "." + (baseUpper ? "SHX" : "shx"));
}
return shxFile;
}
@@ -940,7 +940,7 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe
*/
public Path getDbf(boolean create) {
if (create && dbfFile == null) {
- return shpFile.getParent().resolve(baseName + "." + (baseUpper ? "DBF" : "dbf"));
+ return shpFile.resolveSibling(baseName + "." + (baseUpper ? "DBF" : "dbf"));
}
return dbfFile;
}
@@ -951,7 +951,7 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe
*/
public Path getPrj(boolean create) {
if (create && prjFile == null) {
- return shpFile.getParent().resolve(baseName + "." + (baseUpper ? "PRJ" : "prj"));
+ return shpFile.resolveSibling(baseName + "." + (baseUpper ? "PRJ" : "prj"));
}
return prjFile;
}
@@ -962,7 +962,7 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe
*/
public Path getCpg(boolean create) {
if (create && cpgFile == null) {
- return shpFile.getParent().resolve(baseName + "." + (baseUpper ? "CPG" : "cpg"));
+ return shpFile.resolveSibling(baseName + "." + (baseUpper ? "CPG" : "cpg"));
}
return cpgFile;
}
@@ -1007,9 +1007,9 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe
}
private Path findSibling(String extension) {
- Path candidate = shpFile.getParent().resolve(baseName + "." + extension);
+ Path candidate = shpFile.resolveSibling(baseName + "." + extension);
if (java.nio.file.Files.isRegularFile(candidate)) return candidate;
- candidate = shpFile.getParent().resolve(baseName + "." + extension.toUpperCase());
+ candidate = shpFile.resolveSibling(baseName + "." + extension.toUpperCase());
if (java.nio.file.Files.isRegularFile(candidate)) return candidate;
return null;
}