Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileLayerDeleter will throw NullPointerException #2011

Closed
lossyrob opened this issue Feb 11, 2017 · 1 comment
Closed

FileLayerDeleter will throw NullPointerException #2011

lossyrob opened this issue Feb 11, 2017 · 1 comment

Comments

@lossyrob
Copy link
Member

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.

@lossyrob lossyrob added this to the 1.0.1 milestone Feb 11, 2017
@cepkoCC
Copy link

cepkoCC commented Feb 13, 2017

On it!

@lossyrob lossyrob modified the milestones: 1.1, 1.0.1 Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants