[openrtm-commit:02801] r1035 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 9月 5日 (火) 16:08:18 JST
Author: t-katami
Date: 2017-09-05 16:08:18 +0900 (Tue, 05 Sep 2017)
New Revision: 1035
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java
Log:
[compat,bugfix,->releng_1_2] Fixed the bugs of the rtcname form. refs #3386
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java 2017-09-04 04:57:52 UTC (rev 1034)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java 2017-09-05 07:08:18 UTC (rev 1035)
@@ -86,7 +86,7 @@
m_nameServer = name_server;
m_rootContext = null;
m_blLength = 100;
-
+
Object obj;
int pos = m_nameServer.indexOf("iiop:");
if(pos==0){
@@ -96,12 +96,15 @@
m_nameServer = "corbaloc::" + m_nameServer + "/NameService";
}
// m_nameServer = "corbaloc:iiop:1.2@" + m_nameServer + "/NameService";
-
- //rtcout.println(Logbuf.PARANOID, "m_nameServer="+m_nameServer);
- obj = m_varORB.string_to_object(m_nameServer);
- //rtcout.println(Logbuf.PARANOID, "obj="+obj);
- m_rootContext = NamingContextExtHelper.narrow(obj);
- if (m_rootContext==null) {
+ try{
+ obj = m_varORB.string_to_object(m_nameServer);
+ m_rootContext = NamingContextExtHelper.narrow(obj);
+ if (m_rootContext==null) {
+ throw new Exception("bad_alloc()");
+ }
+ }
+ catch(Exception ex){
+ String crlf = System.getProperty("line.separator");
throw new Exception("bad_alloc()");
}
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java 2017-09-04 04:57:52 UTC (rev 1034)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/NamingOnCorba.java 2017-09-05 07:08:18 UTC (rev 1035)
@@ -8,6 +8,7 @@
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
+import org.omg.CosNaming.NameComponent;
import org.omg.CosNaming.NamingContext;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.CosNaming.BindingIteratorHolder;
@@ -222,18 +223,34 @@
public void get_RTC_by_Name(NamingContext context, String name,
RTCListHolder rtcs){
+ rtcout.println(Logbuf.PARANOID, "get_RTC_by_Name("+name+")");
int length = 500;
BindingListHolder bl = new BindingListHolder();
BindingIteratorHolder bi = new BindingIteratorHolder();
context.list(length,bl,bi);
+ rtcout.println(Logbuf.PARANOID, "bl="+bl);
+ rtcout.println(Logbuf.PARANOID, "bl.vlaue="+bl.value);
+ rtcout.println(Logbuf.PARANOID, "bl.vlaue.length="+bl.value.length);
+ rtcout.println(Logbuf.PARANOID, "bi="+bi);
+ rtcout.println(Logbuf.PARANOID, "bi.vlaue="+bi.value);
+ rtcout.println(Logbuf.PARANOID,
+ "BindingType.ncontext.valeu()="+BindingType.ncontext.value());
+ rtcout.println(Logbuf.PARANOID,
+ "BindingType.nobject.vlaue()="+BindingType.nobject.value());
BindingHolder bindholder = new BindingHolder();
- while (bi.value.next_one(bindholder)) {
- if(bindholder.value.binding_type==BindingType.ncontext){
+ Binding bindings[] = bl.value;
+ for(int ic=0;ic<bindings.length;++ic) {
+ BindingType type = bindings[ic].binding_type;
+ rtcout.println(Logbuf.PARANOID,
+ "bindings[ic].binding_type.value()="
+ +type.value());
+ if(type.value()==BindingType.ncontext.value()){
try{
NamingContext next_context
= NamingContextExtHelper.narrow(
- context.resolve(bindholder.value.binding_name));
+ context.resolve(bindings[ic].binding_name));
+
get_RTC_by_Name(next_context, name, rtcs);
}
catch(Exception ex){
@@ -242,14 +259,21 @@
return;
}
}
- else if(bindholder.value.binding_type==BindingType.nobject){
- if(bindholder.value.binding_name[0].id.equals(name) &&
- bindholder.value.binding_name[0].kind.equals("rtc")){
+ else if(type.value()==BindingType.nobject.value()){
+ NameComponent names[] = bindings[ic].binding_name;
+ rtcout.println(Logbuf.PARANOID,
+ "bindings[ic].binding_name[0].id="
+ +names[0].id);
+ rtcout.println(Logbuf.PARANOID,
+ "bindings[ic].binding_name[0].kind="
+ +names[0].kind);
+ if(names[0].id.equals(name) &&
+ names[0].kind.equals("rtc")){
try{
- CorbaConsumer cc = new CorbaConsumer();
- cc.setObject(context.resolve(
- bindholder.value.binding_name));
- RTObject obj = RTObjectHelper.narrow(cc.getObject());
+ rtcout.println(Logbuf.PARANOID, "names="+names);
+ rtcout.println(Logbuf.PARANOID, "context="+context);
+ RTObject obj =
+ RTObjectHelper.narrow(context.resolve(names));
CORBA_SeqUtil.push_back(rtcs, obj);
}
catch (Exception ex) {
@@ -290,24 +314,42 @@
try{
CorbaNaming cns;
+ rtcout.println(Logbuf.PARANOID, "host="+host);
if(host.equals("*")){
cns = m_cosnaming;
}
else{
ORB orb = ORBUtil.getOrb();
+ String[] names = host.split(":");
+ if (names.length == 1 && !names[0].equals("")) {
+ host += ":2809";
+ }
+ rtcout.println(Logbuf.PARANOID, "host="+host);
cns = new CorbaNaming(orb,host);
}
String[] names = rtc_name.split("/");
+ rtcout.println(Logbuf.PARANOID,
+ "names.length="+names.length);
if(names.length == 2 && names[0].equals("*")){
+ rtcout.println(Logbuf.PARANOID,
+ "cns="+cns);
NamingContext root_cxt = cns.getRootContext();
+ rtcout.println(Logbuf.PARANOID,
+ "names[1]="+names[1]);
get_RTC_by_Name(root_cxt, names[1], rtc_list);
return rtc_list.value;
}
else{
+ rtcout.println(Logbuf.PARANOID,
+ "names[0]="+names[0]);
rtc_name += ".rtc";
+ rtcout.println(Logbuf.PARANOID,
+ "rtc_name.rtc="+rtc_name);
Object obj = cns.resolveStr(rtc_name);
if(obj == null){
+ rtcout.println(Logbuf.PARANOID,
+ rtc_name + " is not found on "+host+".");
return null;
}
CORBA_SeqUtil.push_back(rtc_list,
@@ -316,6 +358,10 @@
}
}
catch (Exception ex) {
+ String crlf = System.getProperty("line.separator");
+ rtcout.println(Logbuf.PARANOID,
+ rtc_name + " is not found on "+host+"."
+ + crlf + ex.toString());
return null;
}
}
More information about the openrtm-commit
mailing list