You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/03/05 01:54:31 UTC

[incubator-nlpcraft] 01/01: Fix for NLPCRAFT-262.

This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-262
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit c999e3c4ea76975c1267f00b22059853ccb3990e
Author: Aaron Radzinzski <ar...@datalingvo.com>
AuthorDate: Thu Mar 4 17:54:19 2021 -0800

    Fix for NLPCRAFT-262.
---
 .../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index 0d411f0..4990849 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -470,13 +470,16 @@ object NCCli extends App {
     private def cleanUpTempFiles(): Unit = {
         val tstamp = currentTime - 1000 * 60 * 60 * 24 * 2 // 2 days ago.
 
-        for (file <- new File(SystemUtils.getUserHome, ".nlpcraft").listFiles())
-            if (file.lastModified() < tstamp) {
-                val name = file.getName
-
-                if (name.startsWith("server_log") || name.startsWith("server_log") || name.startsWith(".pid_"))
-                    file.delete()
-            }
+        val files = new File(SystemUtils.getUserHome, ".nlpcraft").listFiles()
+        
+        if (files != null)
+            for (file <- files)
+                if (file.lastModified() < tstamp) {
+                    val name = file.getName
+    
+                    if (name.startsWith("server_log") || name.startsWith("server_log") || name.startsWith(".pid_"))
+                        file.delete()
+                }
     }
 
     /**