rocker
rocker copied to clipboard
Generation crashes with NPE if a non-normal file is present in the template directory
The method RockerUtil.listFileTree throws a NullPointerException
if there is any file within the template directory which is neither a "normal file" (as defined by File.isFile()
) nor a directory.
In my special case, I had a broken symlink in there, but I think other special files might also trigger this. Fixes which I can think of:
- check with
else if (entry.isDirectory())
, so that special files are ignored and only actual directories are passed to the recursive method call - surround the for-loop with try-catch and print the path of the offending file, so that the user can delete / fix the file
Number 1 sounds like a good, simple fix. If you were interested in helping with the fix and submitted a PR, that would be awesome!