rocker icon indicating copy to clipboard operation
rocker copied to clipboard

Generation crashes with NPE if a non-normal file is present in the template directory

Open lenaschimmel opened this issue 3 years ago • 1 comments

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:

  1. check with else if (entry.isDirectory()), so that special files are ignored and only actual directories are passed to the recursive method call
  2. surround the for-loop with try-catch and print the path of the offending file, so that the user can delete / fix the file

lenaschimmel avatar Dec 06 '21 17:12 lenaschimmel

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!

jjlauer avatar Dec 06 '21 17:12 jjlauer