Skip to content

Commit

Permalink
[GEOS-7882] Fix status NPE when using custom GDAL
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarsballe authored and afabiani committed Dec 8, 2016
1 parent 84187a7 commit 82605dc
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -54,7 +54,7 @@ public boolean isEnabled() {

@Override
public Optional<String> getMessage() {
String message = "JNI GDAL Wrapper Version: " + getGDALWrapperJarVersion();
String message = "JNI GDAL Wrapper Version: " + getGDALWrapperJarVersion().orElse("null");
if (!isAvailable()) {
message += "\njava.library.path: " + System.getProperty("java.library.path", "");
} else {
Expand All @@ -68,11 +68,15 @@ public Optional<String> getDocumentation() {
return Optional.ofNullable("");
}

public String getGDALWrapperJarVersion() {
public Optional<String> getGDALWrapperJarVersion() {
if (isAvailable()) {
return GeoTools.getVersion(gdal.class).toString();
Version v = GeoTools.getVersion(gdal.class);
if (v == null) {
return Optional.empty();
}
return Optional.ofNullable(v.toString());
} else {
return "unavailable";
return Optional.ofNullable("unavailable");
}
}

Expand Down

0 comments on commit 82605dc

Please sign in to comment.