Setup:
Have a File catalog in a state where a layer "exists", in that it has metadata in the attribute store, but the directory path pointed to by the FileLayerHeader.path for that layer does not exist.
Expected:
The FileLayerDeleter delete method will see that there's no file there, and move along exceptionless.
Actual:
It blows up with a null pointer exception with the following stack trace:
error] (run-main-0) java.lang.NullPointerException
java.lang.NullPointerException
at scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:192)
at scala.collection.mutable.ArrayOps$ofRef.length(ArrayOps.scala:192)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:32)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at geotrellis.spark.io.file.FileLayerDeleter$$anon$1.delete(FileLayerDeleter.scala:36)
at geotrellis.spark.io.file.FileLayerDeleter$$anon$1.delete(FileLayerDeleter.scala:16)
at geotrellis.spark.io.file.FileLayerManager.delete(FileLayerManager.scala:20)
Problem code exists here:
|
val sourceLayerPath = new File(attributeStore.catalogPath, header.path) |
|
sourceLayerPath |
|
.listFiles() |
|
.foreach(_.delete()) |
|
|
|
sourceLayerPath.delete |
|
} |
The issue should be fixed by checking sourceLayerPath exists before doing anything with it.
Thanks to @cepkoCC for the bug report.
Setup:
Have a File catalog in a state where a layer "exists", in that it has metadata in the attribute store, but the directory path pointed to by the FileLayerHeader.path for that layer does not exist.
Expected:
The FileLayerDeleter delete method will see that there's no file there, and move along exceptionless.
Actual:
It blows up with a null pointer exception with the following stack trace:
Problem code exists here:
geotrellis/spark/src/main/scala/geotrellis/spark/io/file/FileLayerDeleter.scala
Lines 49 to 55 in e0b98d9
The issue should be fixed by checking
sourceLayerPathexists before doing anything with it.Thanks to @cepkoCC for the bug report.