[IOT-1880] Adding Fixes for issues generated from static analyzer tool in Notificatio...
authorPoovizhi <poovizhi.a@samsung.com>
Fri, 3 Mar 2017 10:24:09 +0000 (15:54 +0530)
committerUze Choi <uzchoi@samsung.com>
Mon, 20 Mar 2017 09:11:16 +0000 (09:11 +0000)
commit47aca923ac0db2cd2e888cf45bedd326459d7e89
treef88adf042b5ac38bddb93de9d15f2a2120a5852f
parent61fb2859fe0a86eca45ea8520aae56378c6ecf13
[IOT-1880] Adding Fixes for issues generated from static analyzer tool in Notification service c++ , JNI layer

1) In JNINotificationConsumer.cpp, Getting native Provider object is common code for all the native methods.
   Added a separate method ' getNativeProvider' to do this, so that method size and complexity will be reduced.

2) JNiNotificationConsumer.cpp Line 1379, and NSTopicslist.cpp Line 59 has changes to fix the issue of Unreachable code.

3) Copy constructor and copy assignment operator are added  in class 'NSAcceptedProviders' & 'NSAcceptedConsumers'  which has dynamically allocated data members

4) In NSAcceptedProviders class, getProviders() method is changed to const since it is being used by the copy constructors and hence
   modified the member variable 'm_mutex' to be mutable.

5) In NSAcceptedConsumers class, getConsumers() method is changed to const since it is being used by the copy constructors
   and hence modified the member variable 'm_mutex' to be mutable.

6) In  NotiListener.java, the NULL check for mProviderSample is moved above the first instance where mProviderSample is beig used.

Change-Id: Ic18c3d9797a02a73f5397192b21e7dda5926119e
Signed-off-by: Poovizhi <poovizhi.a@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17653
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/android/notification-service/src/main/jni/consumer/JniNotificationConsumer.cpp [changed mode: 0755->0644]
service/notification/cpp-wrapper/common/NSTopicsList.cpp [changed mode: 0755->0644]
service/notification/cpp-wrapper/consumer/inc/NSAcceptedProviders.h [changed mode: 0755->0644]
service/notification/cpp-wrapper/consumer/src/NSAcceptedProviders.cpp [changed mode: 0755->0644]
service/notification/cpp-wrapper/consumer/src/NSConsumerService.cpp [changed mode: 0755->0644]
service/notification/cpp-wrapper/provider/inc/NSAcceptedConsumers.h [changed mode: 0755->0644]
service/notification/cpp-wrapper/provider/src/NSAcceptedConsumers.cpp [changed mode: 0755->0644]
service/notification/examples/android/NotiProviderExample/app/src/main/java/org/iotivity/service/ns/sample/provider/NotiListener.java