[openrtm-commit:02724] r989 - in trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src: RTMExamples/ExtTrigger RTMExamples/SimpleIO RTMExamples/TopicTest jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 8月 7日 (月) 16:14:01 JST
Author: t-katami
Date: 2017-08-07 16:14:01 +0900 (Mon, 07 Aug 2017)
New Revision: 989
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java
Log:
[compat,bugfix,->RELENG_1_2] Fixed the items pointed out by the static code analysis tool.
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConnectorComp.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -87,6 +87,10 @@
PortServiceListHolder pout = new PortServiceListHolder();
pout.value = new PortService[0];
+ if((conin == null) || (conout == null)){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find ConsoleIn0 component
try {
conin.setObject(naming.resolve("ConsoleIn0.rtc"));
@@ -185,13 +189,15 @@
} catch (IOException e) {
e.printStackTrace();
}
- if( cmd.equals("0") ) {
- ec0Ref.tick();
- } else if( cmd.equals("1") ) {
- ec1Ref.tick();
- } else if( cmd.equals("2") ) {
- ec0Ref.tick();
- ec1Ref.tick();
+ if(cmd != null){
+ if( cmd.equals("0") ) {
+ ec0Ref.tick();
+ } else if( cmd.equals("1") ) {
+ ec1Ref.tick();
+ } else if( cmd.equals("2") ) {
+ ec0Ref.tick();
+ ec1Ref.tick();
+ }
}
} catch(Exception ex) {
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/ExtTrigger/ConsoleInImpl.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -101,7 +101,10 @@
System.out.println("Please input number: ");
BufferedReader buff = new BufferedReader(new InputStreamReader( System.in ));
try {
- m_out.data = Integer.parseInt(buff.readLine());
+ String str = buff.readLine();
+ if(str != null){
+ m_out.data = Integer.parseInt(str);
+ }
} catch (NumberFormatException e) {
System.out.println("Input number Error!");
// e.printStackTrace();
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/ConnectorComp.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -80,6 +80,10 @@
PortServiceListHolder pout = new PortServiceListHolder();
pout.value = new PortService[0];
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find ConsoleIn0 component
try {
conin.setObject(naming.resolve("ConsoleIn0.rtc"));
@@ -102,6 +106,10 @@
eclisti.value = coninRef.get_owned_contexts();
eclisti.value[0].activate_component(coninRef);
+ if(conout == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find ConsoleOut0 component
try {
conout.setObject(naming.resolve("ConsoleOut0.rtc"));
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_actual_ec.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -57,6 +57,7 @@
if(out_impl==null)
{
System.out.println("ConsoleOut is null.");
+ return;
}
//
Properties prop_in = new Properties(ConsoleIn.component_conf);
@@ -65,6 +66,7 @@
if(in_impl==null)
{
System.out.println("ConsoleIn is null.");
+ return;
}
//
Properties prop_out_seq = new Properties(MyServiceConsumer.component_conf);
@@ -75,6 +77,7 @@
if(out_seq_impl==null)
{
System.out.println("MyServiceConsumer is null.");
+ return;
}
//
//
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/get_component_profile_Comp.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -37,6 +37,11 @@
CorbaConsumer<DataFlowComponent> conin =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
+
// find ConsoleIn0 component
try {
System.out.println( "args[0]:"+args[0] );
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_alive_in_default_ec.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -46,6 +46,10 @@
System.out.println( "EC of " +args[0] + " doesn't exist." );
}
}
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
// find component
try {
conin.setObject(naming.resolve(args[0]));
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleIO/is_existing.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -46,6 +46,9 @@
System.out.println( args[0] + " doesn't exist." );
}
}
+ if(conin == null){
+ return;
+ }
// find component
try {
conin.setObject(naming.resolve(args[0]));
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java 2017-07-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/TopicTest/ConnectorComp.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -170,6 +170,10 @@
CorbaConsumer<DataFlowComponent> conin =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
+ if(conin == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
try {
conin.setObject(naming.resolve("ConsoleIn0.rtc"));
} catch (NotFound e) {
@@ -185,6 +189,10 @@
CorbaConsumer<DataFlowComponent> conout =
new CorbaConsumer<DataFlowComponent>(DataFlowComponent.class);
+ if(conout == null){
+ System.out.println("Failed to create CorbaConsumer.");
+ return;
+ }
try {
conout.setObject(naming.resolve("ConsoleOut0.rtc"));
} catch (NotFound e) {
@@ -199,11 +207,16 @@
PortService port1_var =
CORBA_RTCUtil.get_port_by_name(conout._ptr(), "ConsoleOut0.topic_in");
- if(CORBA_RTCUtil.already_connected(port0_var, port1_var)){
- System.out.println( "OK");
+ if((port0_var != null) && (port1_var != null)){
+ if(CORBA_RTCUtil.already_connected(port0_var, port1_var)){
+ System.out.println( "OK");
+ }
+ else{
+ System.out.println( "Fail");
+ }
}
else{
- System.out.println( "Fail");
+ System.out.println( "Fail");
}
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-28 07:22:28 UTC (rev 988)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerConfig.java 2017-08-07 07:14:01 UTC (rev 989)
@@ -264,7 +264,11 @@
m_argprop.setProperty("manager.corba_servant","NO");;
}
if (commandLine.hasOption("f")) {
- this.m_configFile = commandLine.getOptionValue("f").trim();
+ //this.m_configFile = commandLine.getOptionValue("f").trim();
+ String str = commandLine.getOptionValue("f");
+ if(str != null){
+ this.m_configFile = str.trim();
+ }
}
if (commandLine.hasOption("l")) {
// do nothing
More information about the openrtm-commit
mailing list