bowenliang123 commented on code in PR #6335: URL: https://github.com/apache/kyuubi/pull/6335#discussion_r1706295906
########## kyuubi-common/src/main/scala/org/apache/kyuubi/Utils.scala: ########## @@ -137,12 +137,18 @@ object Utils extends Logging { /** * Delete a directory recursively. */ - def deleteDirectoryRecursively(f: File): Boolean = { - if (f.isDirectory) f.listFiles match { - case files: Array[File] => files.foreach(deleteDirectoryRecursively) - case _ => + def deleteDirectoryRecursively(f: File, forceDelete: Boolean = true): Unit = { + if (f.isDirectory) { + val files = f.listFiles + if (files != null && files.nonEmpty) { + files.foreach(deleteDirectoryRecursively(_, forceDelete)) + } + } + try { + f.delete() + } catch { + case e: Exception if !forceDelete => throw e Review Comment: No problem. `ignoreException` was the original param name in my first draft, changing back to it. Fixed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org