[openrtm-commit:02734] r999 - 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年 8月 9日 (水) 15:27:30 JST
Author: t-katami
Date: 2017-08-09 15:27:29 +0900 (Wed, 09 Aug 2017)
New Revision: 999
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/port/InPort.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.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/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-08-09 02:59:20 UTC (rev 998)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-08-09 06:27:29 UTC (rev 999)
@@ -523,7 +523,6 @@
prop.getProperty("rendezvous_point")=="" )
){
-
continue;
}
PortService[] nsports;
@@ -3665,7 +3664,7 @@
Properties temp = m_config.getNode(category + "." + inst_name);
Vector<String> keys = temp.propertyNames();
int length = keys.size();
- if (!( length == 1 && keys.get(length-1).equals("config_file"))) {
+ if (!( length == 1 && keys.lastElement().equals("config_file"))) {
name_prop.merge(m_config.getNode(category + "." + inst_name));
rtcout.println(Logbuf.INFO,
"Component type conf exists in rtc.conf. Merged.");
@@ -3714,7 +3713,7 @@
Properties temp = m_config.getNode(category + "." + type_name);
Vector<String> keys = temp.propertyNames();
int length = keys.size();
- if (!(length == 1 && keys.get(length-1).equals("config_file"))) {
+ if (!(length == 1 && keys.lastElement().equals("config_file"))) {
type_prop.merge(m_config.getNode(category + "." + type_name));
rtcout.println(Logbuf.INFO,
"Component type conf exists in rtc.conf. Merged.");
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2017-08-09 02:59:20 UTC (rev 998)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2017-08-09 06:27:29 UTC (rev 999)
@@ -655,8 +655,10 @@
public boolean isEmpty() {
rtcout.println(Logbuf.TRACE, "isEmpty()");
- if (m_directNewData == true) {
- return false;
+ synchronized (m_directNewDataMutex){
+ if (m_directNewData == true) {
+ return false;
+ }
}
int r = 0;
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java 2017-08-09 02:59:20 UTC (rev 998)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPort.java 2017-08-09 06:27:29 UTC (rev 999)
@@ -404,49 +404,51 @@
Vector<String> disconnect_ids = new Vector<String>();
synchronized (m_connectorsMutex){
- // check number of connectors
- int conn_size = m_connectors.size();
- if (!(conn_size > 0)) {
- return false;
- }
+ synchronized (m_connectors){
+ // check number of connectors
+ int conn_size = m_connectors.size();
+ if (!(conn_size > 0)) {
+ return false;
+ }
- // set timestamp
-// set_timestamp(value);
+ // set timestamp
+// set_timestamp(value);
- m_status.setSize(conn_size);
+ m_status.setSize(conn_size);
- for (int i=0, len=conn_size; i < len; ++i) {
- ReturnCode ret;
- // data -> (conversion) -> CDR stream
- if (m_OnWriteConvert != null) {
- rtcout.println(Logbuf.DEBUG,
+ for (int i=0, len=conn_size; i < len; ++i) {
+ ReturnCode ret;
+ // data -> (conversion) -> CDR stream
+ if (m_OnWriteConvert != null) {
+ rtcout.println(Logbuf.DEBUG,
"m_connectors.OnWriteConvert called");
- ret = m_connectors.elementAt(i).write(
+ ret = m_connectors.elementAt(i).write(
m_OnWriteConvert.run(value));
- }
- else{
- rtcout.println(Logbuf.DEBUG,
+ }
+ else{
+ rtcout.println(Logbuf.DEBUG,
"m_connectors.write called");
- ret = m_connectors.elementAt(i).write(value);
- }
+ ret = m_connectors.elementAt(i).write(value);
+ }
- m_status.add(i, ret);
- if (ret.equals(ReturnCode.PORT_OK)) {
- continue;
- }
+ m_status.add(i, ret);
+ if (ret.equals(ReturnCode.PORT_OK)) {
+ continue;
+ }
- result = false;
- String id = m_connectors.elementAt(i).id();
+ result = false;
+ String id = m_connectors.elementAt(i).id();
- if (ret.equals(ReturnCode.CONNECTION_LOST)) {
- rtcout.println(Logbuf.TRACE, "connection_lost id: "+id);
- if(m_onConnectionLost != null) {
- RTC.ConnectorProfile prof = findConnProfile(id);
- RTC.ConnectorProfileHolder holder
- = new RTC.ConnectorProfileHolder(prof);
- m_onConnectionLost.run(holder);
+ if (ret.equals(ReturnCode.CONNECTION_LOST)) {
+ rtcout.println(Logbuf.TRACE, "connection_lost id: "+id);
+ if(m_onConnectionLost != null) {
+ RTC.ConnectorProfile prof = findConnProfile(id);
+ RTC.ConnectorProfileHolder holder
+ = new RTC.ConnectorProfileHolder(prof);
+ m_onConnectionLost.run(holder);
+ }
+ disconnect_ids.add(id);
}
- disconnect_ids.add(id);
}
}
}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2017-08-09 02:59:20 UTC (rev 998)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/OutPortBase.java 2017-08-09 06:27:29 UTC (rev 999)
@@ -186,9 +186,11 @@
*
*/
public final Vector<OutPortConnector> connectors(){
- rtcout.println(Logbuf.TRACE,
+ synchronized (m_connectors){
+ rtcout.println(Logbuf.TRACE,
"connectors(): size = "+m_connectors.size());
- return m_connectors;
+ return m_connectors;
+ }
}
/**
* {@.ja ConnectorProfile を取得}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java 2017-08-09 02:59:20 UTC (rev 998)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/PortBase.java 2017-08-09 06:27:29 UTC (rev 999)
@@ -1415,7 +1415,9 @@
}
public void setOnConnectionLost(ConnectionCallback on_connection_lost) {
- m_onConnectionLost = on_connection_lost;
+ synchronized (m_onConnectionLost_mutex){
+ m_onConnectionLost = on_connection_lost;
+ }
}
/**
@@ -2250,6 +2252,7 @@
private final Object m_onDisconnected_mutex = new Object();
protected ConnectionCallback m_onDisconnected;
+ protected final Object m_onConnectionLost_mutex = new Object();
protected ConnectionCallback m_onConnectionLost;
/**
* {@.ja PortConnectListenerホルダ}
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java 2017-08-09 02:59:20 UTC (rev 998)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/Properties.java 2017-08-09 06:27:29 UTC (rev 999)
@@ -720,8 +720,12 @@
*/
public void clear() {
- while (this.leaf.size() > 0) {
- Properties tail = this.leaf.get(this.leaf.size() - 1);
+ while (true) {
+ int ic = this.leaf.size() - 1;
+ if(ic < 0) {
+ break;
+ }
+ Properties tail = this.leaf.get(ic);
if (tail != null) {
tail.destruct();
}
More information about the openrtm-commit
mailing list