[openrtm-commit:02820] r1040 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 9月 13日 (水) 13:42:04 JST


Author: t-katami
Date: 2017-09-13 13:42:04 +0900 (Wed, 13 Sep 2017)
New Revision: 1040

Modified:
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
Log:
[incompat,return] Now Manager::load() function returns error code. refs #4186

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2017-09-11 06:06:53 UTC (rev 1039)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2017-09-13 04:42:04 UTC (rev 1040)
@@ -8,6 +8,7 @@
 import java.io.IOException;
 
 import java.lang.Boolean;
+import java.lang.reflect.InvocationTargetException;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -1383,12 +1384,24 @@
      * @param initFunc 
      *   {@.ja 初期化メソッド名}
      *   {@.en The initialize function name}
+     * @return 
+     *   {@.ja RTC_OK               正常終了
+     *         RTC_ERROR            ロード失敗・不明なエラー 
+     *         PRECONDITION_NOT_MET 設定により許可されない操作
+     *         BAD_PARAMETER        不正なパラメータ}
+     *   {@.en RTC_OK               Normal return
+     *         RTC_ERROR            Load failed, or unknown error
+     *         PRECONDITION_NOT_MET Not allowed operation by conf
+     *         BAD_PARAMETER        Invalid parameter}
      * 
      */
-    public String load(final String moduleFileName, final String initFunc) {
+    //public String load(final String moduleFileName, final String initFunc) {
+    public ReturnCode_t load(final String moduleFileName, final String initFunc) {
+
         
         rtcout.println(Logbuf.TRACE, 
                         "Manager.load("+moduleFileName+","+initFunc+")");
+        String crlf = System.getProperty("line.separator");
         
         String file_name = moduleFileName;
         String init_func = initFunc;
@@ -1400,14 +1413,37 @@
             String path = m_module.load(file_name, init_func);
             rtcout.println(Logbuf.DEBUG, "module path: "+path);
             m_listeners.module_.postLoad(path, init_func);
-            return path;
             
-        } catch (Exception e) {
-            rtcout.println(Logbuf.WARN, 
-                "Exception: Caught unknown Exception in Manager.load().");
-            rtcout.println(Logbuf.WARN, e.getMessage());
+        } 
+        catch (IllegalArgumentException e) {
+            rtcout.println(Logbuf.ERROR, 
+                "Caught Illegal Argument Exception in Manager.load()."
+                + crlf 
+                + e.getMessage());
+            return ReturnCode_t.BAD_PARAMETER;
         }
-        return null;
+        catch (ClassNotFoundException e) {
+            rtcout.println(Logbuf.ERROR, 
+                "Caught Class NotFound Exception in Manager.load()."
+                + crlf 
+                + e.getMessage());
+            return ReturnCode_t.RTC_ERROR;
+        }
+        catch (InvocationTargetException e) {
+            rtcout.println(Logbuf.ERROR, 
+                "Caught Invocation Target Exception in Manager.load()."
+                + crlf 
+                + e.getMessage());
+            return ReturnCode_t.PRECONDITION_NOT_MET;
+        }
+        catch (Exception e) {
+            rtcout.println(Logbuf.ERROR, 
+                "Caught unknown Exception in Manager.load()."
+                + crlf 
+                + e.getMessage());
+            return ReturnCode_t.BAD_PARAMETER;
+        }
+        return ReturnCode_t.RTC_OK;
     }
     
     /**



More information about the openrtm-commit mailing list