[openrtm-commit:02754] r1014 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 8月 17日 (木) 15:35:41 JST


Author: t-katami
Date: 2017-08-17 15:35:41 +0900 (Thu, 17 Aug 2017)
New Revision: 1014

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/Manager.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/CorbaNaming.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java	2017-08-17 05:21:18 UTC (rev 1013)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/CorbaNaming.java	2017-08-17 06:35:41 UTC (rev 1014)
@@ -1564,8 +1564,8 @@
             }
         }
       
-        bi.value.destroy();
-        return;
+        //bi.value.destroy();
+        //return;
     }
 
     /**

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-17 05:21:18 UTC (rev 1013)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java	2017-08-17 06:35:41 UTC (rev 1014)
@@ -3694,8 +3694,9 @@
         if (!(m_config.getProperty(type_conf) == null
                 || m_config.getProperty(type_conf).length() == 0)) {
             
+            BufferedReader conff = null;
             try {
-                BufferedReader conff = new BufferedReader(
+                conff = new BufferedReader(
                         new FileReader(m_config.getProperty(type_conf)));
                 type_prop.load(conff);
                 rtcout.println(Logbuf.INFO,
@@ -3722,6 +3723,18 @@
                 rtcout.println(Logbuf.DEBUG, e.getMessage());
                 e.printStackTrace();
             } 
+            if(conff != null){
+                try {
+                    conff.close();
+                }
+                catch (Exception e) {
+                    rtcout.println(Logbuf.DEBUG, 
+                        "Exception: Caught unknown Exception"
+                        +" in Manager.configureComponent() close error.");
+                    rtcout.println(Logbuf.DEBUG, e.getMessage());
+                    e.printStackTrace();
+                }
+            }
         }
         if (m_config.findNode(category + "." + type_name) != null) {
             Properties temp = m_config.getNode(category + "." + type_name);
@@ -3962,10 +3975,12 @@
             }
         }
         else {
+            FileReader reffile = null;
+            BufferedReader br = null;
             try{
                 String refstring = new String();
-                FileReader reffile = new FileReader(otherref);
-                BufferedReader br = new BufferedReader(reffile); 
+                reffile = new FileReader(otherref);
+                br = new BufferedReader(reffile); 
                 String line;
                 while ((line = br.readLine()) != null) {
                     refstring = refstring + line;
@@ -3981,6 +3996,20 @@
                 //        m_mgrservant.set_owner(mgr);
             } catch (IOException e) {
             }
+            if(br != null){
+                try{
+                    br.close();
+                } 
+                catch (IOException e) {
+                }
+            }
+            if(reffile != null){
+                try{
+                    reffile.close();
+                } 
+                catch (IOException e) {
+                }
+            }
         }
 
         return true;



More information about the openrtm-commit mailing list