[openrtm-commit:02716] r985 - in trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC: . port util
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 7月 27日 (木) 17:27:04 JST
Author: t-katami
Date: 2017-07-27 17:27:04 +0900 (Thu, 27 Jul 2017)
New Revision: 985
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/ManagerConfig.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java
Log:
[compat,bugfix,->RELENG_1_2] Fixed the item pointed out by the static code analysis tool.
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-07-27 05:40:30 UTC (rev 984)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-07-27 08:27:04 UTC (rev 985)
@@ -3317,23 +3317,25 @@
try{
java.util.Enumeration<java.net.NetworkInterface> nic
= java.net.NetworkInterface.getNetworkInterfaces();
- endpoints = new String();
- while(nic.hasMoreElements()) {
- java.net.NetworkInterface netIf = nic.nextElement();
- java.util.Enumeration<java.net.InetAddress> enumAddress
- = netIf.getInetAddresses();
- while(enumAddress.hasMoreElements()){
- java.net.InetAddress inetAdd
- = enumAddress.nextElement();
- String hostString = inetAdd.getHostAddress();
- if(isIpAddressFormat(hostString)){
- if(endpoints.length()!=0){
- endpoints
- = endpoints + "," + hostString + ":";
+ if(nic != null) {
+ endpoints = new String();
+ while(nic.hasMoreElements()) {
+ java.net.NetworkInterface netIf = nic.nextElement();
+ java.util.Enumeration<java.net.InetAddress> enumAddress
+ = netIf.getInetAddresses();
+ while(enumAddress.hasMoreElements()){
+ java.net.InetAddress inetAdd
+ = enumAddress.nextElement();
+ String hostString = inetAdd.getHostAddress();
+ if(isIpAddressFormat(hostString)){
+ if(endpoints.length()!=0){
+ endpoints
+ = endpoints + "," + hostString + ":";
+ }
+ else{
+ endpoints = hostString + ":";
+ }
}
- else{
- endpoints = hostString + ":";
- }
}
}
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java 2017-07-27 05:40:30 UTC (rev 984)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java 2017-07-27 08:27:04 UTC (rev 985)
@@ -18,6 +18,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.HelpFormatter;
/**
* {@.ja Managerのコンフィグレーションを表現するクラスです。}
@@ -243,6 +244,8 @@
commandLine = parser.parse(options, args);
} catch (ParseException e) {
+ HelpFormatter help = new HelpFormatter();
+ help.printHelp("UpdateKeyword", options, true);
throw new IllegalArgumentException("Could not parse arguments.");
}
@@ -278,17 +281,21 @@
*/
if (commandLine.hasOption("p")) {
// ORB's port number
- String str = commandLine.getOptionValue("p").trim();
- int portnum;
- try {
- portnum = Integer.parseInt(str);
- String arg = ":";
- arg += str;
- m_argprop.setProperty("corba.endpoints", arg);
+ //String str = commandLine.getOptionValue("p").trim();
+ String str = commandLine.getOptionValue("p");
+ if(str != null){
+ str = str.trim();
+ int portnum;
+ try {
+ portnum = Integer.parseInt(str);
+ String arg = ":";
+ arg += str;
+ m_argprop.setProperty("corba.endpoints", arg);
+ }
+ catch(Exception ex){
+ //do nothing
+ }
}
- catch(Exception ex){
- //do nothing
- }
}
if (commandLine.hasOption("d")) {
m_isMaster = true;
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java 2017-07-27 05:40:30 UTC (rev 984)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ModuleManager.java 2017-07-27 08:27:04 UTC (rev 985)
@@ -612,6 +612,9 @@
}
java.io.File dir = new java.io.File(loadpath);
String[] flist = dir.list(new FileFilter());
+ if(flist == null) {
+ continue;
+ }
for (int ic=0; ic < flist.length; ++ic) {
dlls.add(loadpath+separator+flist[ic]);
}
@@ -644,6 +647,9 @@
}
}
try {
+ if(target == null){
+ continue;
+ }
Field field = target.getField("component_conf");
String[] data = (String[])field.get(null);
java.util.ArrayList al
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java 2017-07-27 05:40:30 UTC (rev 984)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortAdmin.java 2017-07-27 08:27:04 UTC (rev 985)
@@ -422,7 +422,11 @@
return;
}
- removePort(this.m_portServants.find(new find_port_name(portName)));
+ PortBase port = this.m_portServants.find(new find_port_name(portName));
+ if(port != null){
+ removePort(port);
+ }
+ //removePort(this.m_portServants.find(new find_port_name(portName)));
}
/**
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java 2017-07-27 05:40:30 UTC (rev 984)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/CORBA_RTCUtil.java 2017-07-27 08:27:04 UTC (rev 985)
@@ -606,6 +606,10 @@
return 0.0;
}
ExecutionContext ec = get_actual_ec(rtc);
+ if(ec==null)
+ {
+ return 0.0;
+ }
return ec.get_rate();
}
/**
@@ -634,6 +638,10 @@
return ReturnCode_t.BAD_PARAMETER;
}
ExecutionContext ec = get_actual_ec(rtc);
+ if(ec==null)
+ {
+ return ReturnCode_t.BAD_PARAMETER;
+ }
return ec.set_rate(rate);
}
More information about the openrtm-commit
mailing list