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

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


The following commit(s) were added to refs/heads/master by this push:
     new b2fdac6  Update NCCliModelClassCompleter.java
b2fdac6 is described below

commit b2fdac692eff872348e2416b3bdc71b22f60d604
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sat Jul 3 20:56:23 2021 -0700

    Update NCCliModelClassCompleter.java
---
 .../tools/cmdline/NCCliModelClassCompleter.java    | 25 +++++++++++-----------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliModelClassCompleter.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliModelClassCompleter.java
index 497c360..50a6412 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliModelClassCompleter.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliModelClassCompleter.java
@@ -38,25 +38,26 @@ class NCCliModelClassCompleter {
      * @throws IOException Thrown in case of any I/O errors.
      */
     private Set<String> getClassNamesFromJar(File jarPath) throws IOException {
-        assert jarPath != null && 
jarPath.getAbsolutePath().toLowerCase().endsWith(".jar");
+        assert jarPath != null;
 
         Set<String> classNames = new HashSet<>();
 
-        try (JarFile jarFile = new JarFile(jarPath)) {
-            Enumeration<JarEntry> entries = jarFile.entries();
+        if (jarPath.getAbsolutePath().toLowerCase().endsWith(".jar"))
+            try (JarFile jarFile = new JarFile(jarPath)) {
+                Enumeration<JarEntry> entries = jarFile.entries();
 
-            while (entries.hasMoreElements()) {
-                JarEntry entry = entries.nextElement();
+                while (entries.hasMoreElements()) {
+                    JarEntry entry = entries.nextElement();
 
-                if (entry.getName().endsWith(".class"))
-                    classNames.add(entry.getName()
-                        .replace("/", ".")
-                        .replace(".class", "")
-                    );
+                    if (entry.getName().endsWith(".class"))
+                        classNames.add(entry.getName()
+                            .replace("/", ".")
+                            .replace(".class", "")
+                        );
+                }
             }
 
-            return classNames;
-        }
+        return classNames;
     }
 
     /**

Reply via email to