You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2021/04/26 13:55:29 UTC

[incubator-nlpcraft] branch master updated: Intents methods processing fixed.

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

sergeykamov 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 5b5d5fa  Intents methods processing fixed.
5b5d5fa is described below

commit 5b5d5fa4cdf63a8083b822842664f136d9664694
Author: Sergey Kamov <sk...@gmail.com>
AuthorDate: Mon Apr 26 16:55:19 2021 +0300

    Intents methods processing fixed.
---
 .../org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
index 240e318..4be20b5 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/deploy/NCDeployManager.scala
@@ -18,7 +18,7 @@
 package org.apache.nlpcraft.probe.mgrs.deploy
 
 import java.io._
-import java.lang.reflect.{InvocationTargetException, Method, ParameterizedType, Type, WildcardType}
+import java.lang.reflect.{InvocationTargetException, Method, Modifier, ParameterizedType, Type, WildcardType}
 import java.util
 import java.util.function.Function
 import java.util.jar.JarInputStream
@@ -1212,7 +1212,9 @@ object NCDeployManager extends NCService with DecorateAsScala {
     private def invoke(mtd: Method, mdl: NCModel, args: Array[AnyRef]): NCResult = {
         val mdlId = mdl.getId
 
-        var flag = mtd.canAccess(mdl)
+        val obj = if (Modifier.isStatic(mtd.getModifiers)) null else mdl
+
+        var flag = mtd.canAccess(obj)
 
         try {
             if (!flag) {
@@ -1223,7 +1225,7 @@ object NCDeployManager extends NCService with DecorateAsScala {
             else
                 flag = false
 
-            mtd.invoke(mdl, args: _*).asInstanceOf[NCResult]
+            mtd.invoke(obj, args: _*).asInstanceOf[NCResult]
         }
         catch {
             case e: InvocationTargetException ⇒ e.getTargetException match {