[openrtm-commit:03073] r1100 - in branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC: src/jp/go/aist/rtm/RTC tests/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2018年 1月 17日 (水) 17:35:47 JST
Author: t-katami
Date: 2018-01-17 17:35:47 +0900 (Wed, 17 Jan 2018)
New Revision: 1100
Modified:
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java
Log:
[merge] r1040,r1041,r1042 have been merged from trunk.
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2018-01-17 08:27:13 UTC (rev 1099)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2018-01-17 08:35:47 UTC (rev 1100)
@@ -7,6 +7,9 @@
import java.io.FileWriter;
import java.io.IOException;
+import java.lang.Boolean;
+import java.lang.reflect.InvocationTargetException;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
@@ -1372,12 +1375,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;
@@ -1389,14 +1404,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;
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java 2018-01-17 08:27:13 UTC (rev 1099)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java 2018-01-17 08:35:47 UTC (rev 1100)
@@ -578,10 +578,24 @@
}
manager.activateManager();
manager.m_module.allowAbsolutePath();
- String str = manager.load("jp.go.aist.rtm.RTC.util.TimeValue", "sign");
+ //String str = manager.load("jp.go.aist.rtm.RTC.util.TimeValue", "sign");
+ ReturnCode_t ret;
+ ret = manager.load("jp.go.aist.rtm.RTC.util.TimeValue", "sign");
+ assertEquals(ret,ReturnCode_t.RTC_OK);
+ ret = manager.load("", "sign");
+ assertEquals(ret,ReturnCode_t.BAD_PARAMETER);
+
+ ret = manager.load("jp.go.aist.rtm.RTC.util.TimeValue", "abc");
+ assertEquals(ret,ReturnCode_t.BAD_PARAMETER);
+
+ ret = manager.load("jp.go.aist.rtm.RTC.util.ByteHolder", "stringFrom");
+ assertEquals(ret,ReturnCode_t.BAD_PARAMETER);
+
+
+
+
manager.unload("jp.go.aist.rtm.RTC.util.TimeValue");
-
manager.unloadAll();
Vector<Properties> modules = manager.getLoadedModules();
assertEquals(0, modules.size());
@@ -842,6 +856,10 @@
rootPath = rootPath.substring(0,rootPath.length()-1);
String testPath = rootPath + "tests/fixtures/Manager/fixture4.conf";
String param[] = {"-f", testPath };
+ if(m_mgr != null){
+ System.out.println("m_mgr != null");
+ m_mgr.shutdown();
+ }
m_mgr = Manager.init(param);
assertNotNull(m_mgr);
assertNotNull(m_mgr.getORB());
More information about the openrtm-commit
mailing list