[IOT-1773]Removing redundant return code by modifying Java APIs to return void.
authorabitha.s <abitha.s@samsung.com>
Tue, 24 Jan 2017 08:55:37 +0000 (14:25 +0530)
committerUze Choi <uzchoi@samsung.com>
Thu, 26 Jan 2017 01:17:19 +0000 (01:17 +0000)
As error status is thrown in exception

Change-Id: I3bd917cb1840db51ade54e49033b2281416d7add
Signed-off-by: abitha.s <abitha.s@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16723
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
20 files changed:
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/common/MediaContents.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/common/Message.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/common/SyncInfo.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/common/Topic.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/common/TopicsList.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/consumer/ConsumerService.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/consumer/Provider.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/provider/Consumer.java
service/notification/android/notification-service/src/main/java/org/iotivity/service/ns/provider/ProviderService.java
service/notification/android/notification-service/src/main/jni/consumer/JniNotificationConsumer.cpp
service/notification/android/notification-service/src/main/jni/consumer/JniNotificationConsumer.h
service/notification/android/notification-service/src/main/jni/provider/JniNotificationProvider.cpp
service/notification/android/notification-service/src/main/jni/provider/JniNotificationProvider.h
service/notification/examples/android/NotiConsumerExample/app/src/androidTest/java/org/iotivity/service/ns/sample/consumer/ExampleUnitTest.java
service/notification/examples/android/NotiConsumerExample/app/src/androidTest/java/org/iotivity/service/ns/sample/consumer/ProviderSimulator.java [changed mode: 0644->0755]
service/notification/examples/android/NotiConsumerExample/app/src/main/java/org/iotivity/service/ns/sample/consumer/ConsumerSample.java
service/notification/examples/android/NotiConsumerExample/app/src/main/java/org/iotivity/service/ns/sample/consumer/MainActivity.java
service/notification/examples/android/NotiProviderExample/app/src/androidTest/java/org/iotivity/service/ns/sample/provider/ExampleUnitTest.java [changed mode: 0644->0755]
service/notification/examples/android/NotiProviderExample/app/src/main/java/org/iotivity/service/ns/sample/provider/MainActivity.java [changed mode: 0644->0755]
service/notification/examples/android/NotiProviderExample/app/src/main/java/org/iotivity/service/ns/sample/provider/ProviderSample.java [changed mode: 0644->0755]

index 52e5ced..4766ff0 100755 (executable)
@@ -31,7 +31,7 @@ public class MediaContents {
 
     private static final String LOG_TAG    = "NotificationService_MediaContents";
 
-    public String               mIconImage = null;
+    private String               mIconImage = null;
 
     public MediaContents(String iconImage) {
         Log.i(LOG_TAG, "MediaContents()");
index 8d01ef6..8466970 100755 (executable)
@@ -53,18 +53,18 @@ public class Message {
         }
     };
 
-    public long             mMessageId     = 0;
-    public String           mProviderId    = null;
-
-    public String           mSourceName    = null;
-    public MessageType      mType          = MessageType.ALERT;
-    public String           mTime          = null;
-    public long             mTTL           = 0;
-    public String           mTitle         = null;
-    public String           mContentText   = null;
-    public MediaContents    mMediaContents = null;
-    public String           mTopic         = null;
-    public OcRepresentation mExtraInfo     = null;
+    private long             mMessageId     = 0;
+    private String           mProviderId    = null;
+
+    private String           mSourceName    = null;
+    private MessageType      mType          = MessageType.ALERT;
+    private String           mTime          = null;
+    private long             mTTL           = 0;
+    private String           mTitle         = null;
+    private String           mContentText   = null;
+    private MediaContents    mMediaContents = null;
+    private String           mTopic         = null;
+    private OcRepresentation mExtraInfo     = null;
 
     private long            mNativeHandle  = 0;
 
index 70b970d..aa94b65 100755 (executable)
@@ -50,9 +50,9 @@ public class SyncInfo {
         }
     };
 
-    public long     mMessageId  = 0;
-    public String   mProviderId = null;
-    public SyncType mState      = SyncType.UNREAD;
+    private long     mMessageId  = 0;
+    private String   mProviderId = null;
+    private SyncType mState      = SyncType.UNREAD;
 
     public SyncInfo(long messageId, String providerId, SyncType state) {
         Log.i(LOG_TAG, "SyncInfo()");
index 40c4595..e949d2c 100644 (file)
@@ -51,8 +51,8 @@ public class Topic {
 
     };
 
-    public String     mTopicName = null;
-    public TopicState mState     = TopicState.UNSUBSCRIBED;
+    private String     mTopicName = null;
+    private TopicState mState     = TopicState.UNSUBSCRIBED;
 
     public Topic(String topicName, TopicState state) {
         Log.i(LOG_TAG, "Topic()");
index 64c3a88..62c288e 100644 (file)
@@ -33,7 +33,7 @@ public class TopicsList {
 
     private static final String LOG_TAG     = "NotificationService_TopicList";
 
-    public Vector<Topic>        mTopicsList = new Vector<Topic>();
+    private Vector<Topic>        mTopicsList = new Vector<Topic>();
 
     public void addTopic(String topicname, Topic.TopicState state) {
         mTopicsList.add(new Topic(topicname, state));
index def5940..fa9f78c 100755 (executable)
@@ -105,13 +105,11 @@ public class ConsumerService {
      * @param topicName
      *            the interest Topic name for subscription
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to subscribe to MQ server
      */
-    public int subscribeMQService(String servAdd, String topicName)
+    public void subscribeMQService(String servAdd, String topicName)
             throws NSException {
-        return nativeSubscribeMQService(servAdd, topicName);
+        nativeSubscribeMQService(servAdd, topicName);
     }
 
     /**
@@ -146,7 +144,7 @@ public class ConsumerService {
     private native void nativeEnableRemoteService(String serverAddress)
             throws NSException;
 
-    private native int nativeSubscribeMQService(String servAdd,
+    private native void nativeSubscribeMQService(String servAdd,
             String topicName) throws NSException;
 
     private native void nativeRescanProvider() throws NSException;
index c3823df..e42da4a 100755 (executable)
@@ -53,7 +53,7 @@ public class Provider {
         }
     };
 
-    public String mProviderId   = null;
+    private String mProviderId   = null;
     private long  mNativeHandle = 0;
 
     /**
@@ -167,12 +167,10 @@ public class Provider {
      * @param topicsList
      *            TopicsList of interested Topics
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failure to update topic list. 
      */
-    public int updateTopicList(TopicsList topicsList) throws NSException {
-        return nativeUpdateTopicList(topicsList);
+    public void updateTopicList(TopicsList topicsList) throws NSException {
+        nativeUpdateTopicList(topicsList);
     }
 
     /**
@@ -233,7 +231,7 @@ public class Provider {
 
     public native TopicsList nativeGetTopicList() throws NSException;
 
-    private native int nativeUpdateTopicList(TopicsList topicsList)
+    private native void nativeUpdateTopicList(TopicsList topicsList)
             throws NSException;
 
     private native ProviderState nativeGetProviderState() throws NSException;
index d16b58b..fd4c01e 100644 (file)
@@ -29,7 +29,7 @@ import java.util.Vector;
  */
 public class Consumer {
 
-    public String mConsumerId = null;
+    private String mConsumerId = null;
 
     /**
      * Constructor of Consumer
@@ -57,12 +57,10 @@ public class Consumer {
      *            boolean variable representing Subscription response as
      *            TRUE/FALSE.
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failure accepting subscription request
      */
-    public int acceptSubscription(boolean accepted) throws NSException {
-        return nativeAcceptSubscription(mConsumerId, accepted);
+    public void acceptSubscription(boolean accepted) throws NSException {
+        nativeAcceptSubscription(mConsumerId, accepted);
     }
 
     /**
@@ -71,12 +69,10 @@ public class Consumer {
      * @param topicName
      *            Topic name to select
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failure selecting a topic
      */
-    public int setTopic(String topicName) throws NSException {
-        return nativeSetConsumerTopic(mConsumerId, topicName);
+    public void setTopic(String topicName) throws NSException {
+        nativeSetConsumerTopic(mConsumerId, topicName);
     }
 
     /**
@@ -85,12 +81,10 @@ public class Consumer {
      * @param topicName
      *            Topic name to Unselect
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failure unselecting topic
      */
-    public int unsetTopic(String topicName) throws NSException {
-        return nativeUnsetConsumerTopic(mConsumerId, topicName);
+    public void unsetTopic(String topicName) throws NSException {
+        nativeUnsetConsumerTopic(mConsumerId, topicName);
     }
 
     /**
@@ -104,13 +98,13 @@ public class Consumer {
         return nativeGetConsumerTopicList(mConsumerId);
     }
 
-    public native int nativeAcceptSubscription(String consumerId,
+    public native void nativeAcceptSubscription(String consumerId,
             boolean accepted) throws NSException;
 
-    public native int nativeSetConsumerTopic(String consumerId,
+    public native void nativeSetConsumerTopic(String consumerId,
             String topicName) throws NSException;
 
-    public native int nativeUnsetConsumerTopic(String consumerId,
+    public native void nativeUnsetConsumerTopic(String consumerId,
             String topicName) throws NSException;
 
     public native TopicsList nativeGetConsumerTopicList(String consumerId)
index db8e50f..9128524 100755 (executable)
@@ -76,28 +76,24 @@ public class ProviderService {
      * @param resourceSecurity
      *            Set on/off for secure resource channel setting
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException
      *             if any callback parameter passed is null
      */
-    public int start(OnConsumerSubscribedListener subscribedListener,
+    public void start(OnConsumerSubscribedListener subscribedListener,
             OnMessageSynchronizedListener messageSynchronized,
             boolean subControllability, String userInfo,
             boolean resourceSecurity) throws NSException {
-        return nativeStart(subscribedListener, messageSynchronized,
+        nativeStart(subscribedListener, messageSynchronized,
                 subControllability, userInfo, resourceSecurity);
     }
 
     /**
      * Stop ProviderService
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to stop ProviderService
      */
-    public int stop() throws NSException {
-        return nativeStop();
+    public void stop() throws NSException {
+        nativeStop();
     }
 
     /**
@@ -106,12 +102,10 @@ public class ProviderService {
      * @param message
      *            Notification message including id, title, contentText
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to send notification message
      */
-    public int sendMessage(Message message) throws NSException {
-        return nativeSendMessage(message);
+    public void sendMessage(Message message) throws NSException {
+        nativeSendMessage(message);
     }
 
     /**
@@ -148,12 +142,10 @@ public class ProviderService {
      *            servAdd combined with IP address and port number using
      *            delimiter
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to publish resource
      */
-    public int enableRemoteService(String servAdd) throws NSException {
-        return nativeEnableRemoteService(servAdd);
+    public void enableRemoteService(String servAdd) throws NSException {
+        nativeEnableRemoteService(servAdd);
     }
 
     /**
@@ -163,12 +155,10 @@ public class ProviderService {
      *            servAdd combined with IP address and port number using
      *            delimiter
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to publish resource
      */
-    public int disableRemoteService(String servAdd) throws NSException {
-        return nativeDisableRemoteService(servAdd);
+    public void disableRemoteService(String servAdd) throws NSException {
+        nativeDisableRemoteService(servAdd);
     }
 
     /**
@@ -180,13 +170,11 @@ public class ProviderService {
      * @param topicName
      *            the interest Topic name for subscription
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to subscribe to MQ server
      */
-    public int subscribeMQService(String servAdd, String topicName)
+    public void subscribeMQService(String servAdd, String topicName)
             throws NSException {
-        return nativeSubscribeMQService(servAdd, topicName);
+        nativeSubscribeMQService(servAdd, topicName);
     }
 
     /**
@@ -195,12 +183,10 @@ public class ProviderService {
      * @param topicName
      *            Topic name to add
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to add topic
      */
-    public int registerTopic(String topicName) throws NSException {
-        return nativeRegisterTopic(topicName);
+    public void registerTopic(String topicName) throws NSException {
+        nativeRegisterTopic(topicName);
     }
 
     /**
@@ -209,19 +195,15 @@ public class ProviderService {
      * @param topicName
      *            Topic name to add
      *
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
-     *
      * @throws NSException failed to delete topic
      */
-    public int unregisterTopic(String topicName) throws NSException {
-        return nativeUnregisterTopic(topicName);
+    public void unregisterTopic(String topicName) throws NSException {
+        nativeUnregisterTopic(topicName);
     }
 
     /**
      * Request topics list already registered by provider user
      *
-     * 
-     * @return result code 100 = OK , 200 = ERROR , 300 = SUCCESS , 400 = FAIL
      *
      * @throws NSException failed to get topics list
      */
@@ -260,33 +242,33 @@ public class ProviderService {
         public void onMessageSynchronized(SyncInfo syncInfo);
     }
 
-    public native int nativeStart(
+    public native void nativeStart(
             OnConsumerSubscribedListener subscribedListener,
             OnMessageSynchronizedListener messageSynchronized,
             boolean subControllability, String userInfo,
             boolean resourceSecurity) throws NSException;
 
-    public native int nativeStop() throws NSException;
+    public native void nativeStop() throws NSException;
 
-    public native int nativeSendMessage(Message message) throws NSException;
+    public native void nativeSendMessage(Message message) throws NSException;
 
     public native void nativeSendSyncInfo(long messageId, int type)
             throws NSException;
 
     public native Message nativeCreateMessage() throws NSException;
 
-    public native int nativeEnableRemoteService(String servAdd)
+    public native void nativeEnableRemoteService(String servAdd)
             throws NSException;
 
-    public native int nativeDisableRemoteService(String servAdd)
+    public native void nativeDisableRemoteService(String servAdd)
             throws NSException;
 
-    public native int nativeSubscribeMQService(String servAdd, String topicName)
+    public native void nativeSubscribeMQService(String servAdd, String topicName)
             throws NSException;
 
-    public native int nativeRegisterTopic(String topicName) throws NSException;
+    public native void nativeRegisterTopic(String topicName) throws NSException;
 
-    public native int nativeUnregisterTopic(String topicName)
+    public native void nativeUnregisterTopic(String topicName)
             throws NSException;
 
     public native TopicsList nativeGetRegisteredTopicList() throws NSException;
index 85550e7..03191eb 100755 (executable)
@@ -1027,7 +1027,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_ns_consumer_ConsumerService_nat
     return;\r
 }\r
 \r
-JNIEXPORT jint JNICALL\r
+JNIEXPORT void JNICALL\r
 Java_org_iotivity_service_ns_consumer_ConsumerService_nativeEnableRemoteService\r
 (JNIEnv *env, jobject jObj, jstring jServerAddress)\r
 {\r
@@ -1035,7 +1035,7 @@ Java_org_iotivity_service_ns_consumer_ConsumerService_nativeEnableRemoteService
     if (!jServerAddress)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "EnableRemoteService server address NULL");\r
-        return (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
     const char *serverAddress = env->GetStringUTFChars(jServerAddress, 0);\r
     OIC::Service::NSResult result =\r
@@ -1044,14 +1044,14 @@ Java_org_iotivity_service_ns_consumer_ConsumerService_nativeEnableRemoteService
     if (result !=  OIC::Service::NSResult::OK)\r
     {\r
         ThrowNSException((int) result, "Fail to EnableRemoteService");\r
-        return (jint) result;\r
+        return;\r
     }\r
     env->ReleaseStringUTFChars(jServerAddress, serverAddress);\r
     LOGD (TAG,"ConsumerService_EnableRemoteService - OUT");\r
-    return (jint) result;\r
+    return;\r
 }\r
 \r
-JNIEXPORT jint JNICALL\r
+JNIEXPORT void JNICALL\r
 Java_org_iotivity_service_ns_consumer_ConsumerService_nativeSubscribeMQService\r
 (JNIEnv *env, jobject jObj, jstring jserverAddress, jstring jTopicName)\r
 {\r
@@ -1059,12 +1059,12 @@ Java_org_iotivity_service_ns_consumer_ConsumerService_nativeSubscribeMQService
     if (!jserverAddress)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "Server Address Can't be NULL");\r
-        return (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
     if (!jTopicName)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "TopicName Can't be NULL");\r
-        return (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
 \r
     const char *address = env->GetStringUTFChars( jserverAddress, NULL);\r
@@ -1078,12 +1078,12 @@ Java_org_iotivity_service_ns_consumer_ConsumerService_nativeSubscribeMQService
     if (result !=  OIC::Service::NSResult::OK)\r
     {\r
         ThrowNSException((int) result, "Fail to Subscribe to MQ Service");\r
-        return (jint) result;\r
+        return;\r
     }\r
     env->ReleaseStringUTFChars(jserverAddress, address);\r
     env->ReleaseStringUTFChars(jTopicName, topic);\r
     LOGD (TAG,"ConsumerService: nativeSubscribeMQService - OUT");\r
-    return (jint) result;\r
+    return;\r
 }\r
 \r
 JNIEXPORT void JNICALL Java_org_iotivity_service_ns_consumer_ConsumerService_nativeRescanProvider\r
@@ -1373,34 +1373,34 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeG
     return obj_topicList;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeUpdateTopicList\r
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeUpdateTopicList\r
 (JNIEnv *env, jobject jObj, jobject jTopicsList)\r
 {\r
     LOGD (TAG,"Provider_nativeUpdateTopicList -IN");\r
     if (!jTopicsList)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "TopicList cannot be null");\r
-        return (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
     OIC::Service::NSTopicsList *nsTopicsList = getNativeTopicsList(env, jTopicsList);\r
     if (nsTopicsList == nullptr)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "NSTopicList cannot be created ");\r
-        return (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
 \r
     jclass providerClass = env->GetObjectClass(jObj);\r
     if (!providerClass)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "Failed to Get ObjectClass for Provider");\r
-        return  (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
 \r
     jfieldID nativeHandle = env->GetFieldID(providerClass, "mNativeHandle", "J");\r
     if (!nativeHandle)\r
     {\r
         ThrowNSException(JNI_INVALID_VALUE, "Failed to get nativeHandle for Provider");\r
-        return  (jint) OIC::Service::NSResult::ERROR;\r
+        return;\r
     }\r
     jlong jProvider = env->GetLongField(jObj, nativeHandle);\r
     OIC::Service::NSResult result = OIC::Service::NSResult::ERROR;\r
@@ -1416,7 +1416,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeUpda
         if (provider == nullptr)\r
         {\r
             ThrowNSException(JNI_INVALID_VALUE, "Provider with Given Id doesn't exist");\r
-            return (jint) OIC::Service::NSResult::ERROR;\r
+            return;\r
         }\r
         LOGD (TAG,"calling subscribe on ProviderID");\r
         result = provider->updateTopicList(nsTopicsList);\r
@@ -1424,10 +1424,10 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeUpda
     if (result !=  OIC::Service::NSResult::OK)\r
     {\r
         ThrowNSException((int) result, "Fail to Update Interest Topics");\r
-        return (jint) result;\r
+        return;\r
     }\r
     LOGD (TAG,"Provider_nativeUpdateTopicList -OUT");\r
-    return (jint) result;\r
+    return;\r
 }\r
 \r
 JNIEXPORT jobject JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeGetProviderState\r
index bd24deb..57e6b8d 100755 (executable)
@@ -47,18 +47,18 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_ns_consumer_ConsumerService_nat
 /*\r
  * Class:     org_iotivity_service_ns_consumer_ConsumerService\r
  * Method:    nativeEnableRemoteService\r
- * Signature: (Ljava/lang/String;)I\r
+ * Signature: (Ljava/lang/String;)V\r
  */\r
-JNIEXPORT jint JNICALL\r
+JNIEXPORT void JNICALL\r
 Java_org_iotivity_service_ns_consumer_ConsumerService_nativeEnableRemoteService\r
 (JNIEnv *, jobject, jstring);\r
 \r
 /*\r
  * Class:     org_iotivity_service_ns_consumer_ConsumerService\r
  * Method:    nativeSubscribeMQService\r
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I\r
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V\r
  */\r
-JNIEXPORT jint JNICALL\r
+JNIEXPORT void JNICALL\r
 Java_org_iotivity_service_ns_consumer_ConsumerService_nativeSubscribeMQService\r
 (JNIEnv *, jobject, jstring, jstring);\r
 \r
@@ -114,9 +114,9 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeG
 /*\r
  * Class:     org_iotivity_service_ns_consumer_Provider\r
  * Method:    nativeUpdateTopicList\r
- * Signature: (Lorg/iotivity/service/ns/common/TopicsList;)I\r
+ * Signature: (Lorg/iotivity/service/ns/common/TopicsList;)V\r
  */\r
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeUpdateTopicList\r
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_consumer_Provider_nativeUpdateTopicList\r
 (JNIEnv *, jobject, jobject);\r
 \r
 /*\r
index 4673a3e..cb6360c 100755 (executable)
@@ -870,7 +870,7 @@ void onSyncInfoListenerCb(OIC::Service::NSSyncInfo *sync)
 
 }
 
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStart
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStart
 (JNIEnv *env, jobject jObj, jobject jSubscriptionListener, jobject jSyncListener,
  jboolean jPolicy, jstring jUserInfo, jboolean jResourceSecurity)
 {
@@ -878,7 +878,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     if (!jSubscriptionListener || !jSyncListener)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Listener cannot be null");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
 
     if (g_obj_subscriptionListener != NULL)
@@ -911,14 +911,14 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     if (result != OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to start NSProviderService");
-
+        return;
     }
 
     LOGD (TAG,"JNIProviderService: nativeStart - OUT");
-    return (jint) result;
+    return;
 }
 
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStop
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStop
 (JNIEnv *env, jobject jObj)
 {
     LOGD (TAG,"JNIProviderService: nativeStop - IN");
@@ -927,7 +927,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to stop NSProviderService");
-        return (jint) result;
+        return;
     }
 
     env->DeleteGlobalRef( g_obj_subscriptionListener);
@@ -936,32 +936,33 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     g_obj_syncListener = NULL;
 
     LOGD (TAG,"JNIProviderService: nativeStop - OUT");
-    return (jint) result;
+    return;
 }
 
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeSendMessage
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeSendMessage
 (JNIEnv *env, jobject jObj, jobject jMsg)
 {
     LOGD (TAG,"JNIProviderService: nativeSendMessage - IN");
     if (!jMsg)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Message cannot be null");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     OIC::Service::NSMessage *nsMsg = getNativeMessage(env, jMsg);
     if (nsMsg == nullptr)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Message didn't have a field ID ");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
 
     OIC::Service::NSResult result = OIC::Service::NSProviderService::getInstance()->sendMessage(nsMsg);
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to send NSProvider Message");
+        return;
     }
     LOGD (TAG,"JNIProviderService: nativeSendMessage - OUT");
-    return (jint) result;
+    return;
 }
 
 JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeSendSyncInfo
@@ -1000,7 +1001,7 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ns_provider_ProviderService_
     return jMsg;
 }
 
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_org_iotivity_service_ns_provider_ProviderService_nativeEnableRemoteService
 (JNIEnv *env, jobject jObj, jstring jstr)
 {
@@ -1008,7 +1009,7 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeEnableRemoteService
     if (!jstr)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Server Address Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
 
     const char *address = env->GetStringUTFChars( jstr, NULL);
@@ -1019,13 +1020,14 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeEnableRemoteService
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Enable Remote Service");
+        return;
     }
     env->ReleaseStringUTFChars(jstr, address);
     LOGD (TAG,"JNIProviderService: nativeEnableRemoteService - OUT");
-    return (jint) result;
+    return;
 }
 
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_org_iotivity_service_ns_provider_ProviderService_nativeDisableRemoteService
 (JNIEnv *env, jobject jObj, jstring jstr)
 {
@@ -1033,7 +1035,7 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeDisableRemoteService
     if (!jstr)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Server Address Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
 
     const char *address = env->GetStringUTFChars( jstr, NULL);
@@ -1044,13 +1046,14 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeDisableRemoteService
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Disable Remote Service");
+        return;
     }
     env->ReleaseStringUTFChars(jstr, address);
     LOGD (TAG,"JNIProviderService: nativeDisableRemoteService - OUT");
-    return (jint) result;
+    return;
 }
 
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_org_iotivity_service_ns_provider_ProviderService_nativeSubscribeMQService
 (JNIEnv *env, jobject jObj, jstring jserverAddress, jstring jTopicName)
 {
@@ -1058,12 +1061,12 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeSubscribeMQService
     if (!jserverAddress)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Server Address Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     if (!jTopicName)
     {
         ThrowNSException(JNI_INVALID_VALUE, "TopicName Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
 
     const char *address = env->GetStringUTFChars( jserverAddress, NULL);
@@ -1077,21 +1080,22 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeSubscribeMQService
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Subscribe to MQ Service");
+        return;
     }
     env->ReleaseStringUTFChars(jserverAddress, address);
     env->ReleaseStringUTFChars(jTopicName, topic);
     LOGD (TAG,"JNIProviderService: nativeSubscribeMQService - OUT");
-    return (jint) result;
+    return;
 }
 
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeRegisterTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeRegisterTopic
 (JNIEnv *env, jobject jObj, jstring jTopicName)
 {
     LOGD (TAG,"JNIProviderService: nativeRegisterTopic - IN");
     if (!jTopicName)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Topic Name Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     const char *name = env->GetStringUTFChars( jTopicName, NULL);
     std::string topicName(name);
@@ -1100,19 +1104,20 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Register Topic");
+        return;
     }
     env->ReleaseStringUTFChars(jTopicName, name);
     LOGD (TAG,"JNIProviderService: nativeRegisterTopic - OUT");
-    return (jint) result;
+    return;
 }
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeUnregisterTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeUnregisterTopic
 (JNIEnv *env, jobject jObj, jstring jTopicName)
 {
     LOGD (TAG,"JNIProviderService: nativeUnregisterTopic - IN");
     if (!jTopicName)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Topic Name Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     const char *name = env->GetStringUTFChars( jTopicName, NULL);
     std::string topicName(name);
@@ -1121,10 +1126,11 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Unregister Topic");
+        return;
     }
     env->ReleaseStringUTFChars(jTopicName, name);
     LOGD (TAG,"JNIProviderService: nativeUnregisterTopic - OUT");
-    return (jint) result;
+    return;
 }
 
 JNIEXPORT jobject JNICALL
@@ -1148,14 +1154,14 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeGetRegisteredTopicLi
     return obj_topicList;
 }
 
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcceptSubscription
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcceptSubscription
 (JNIEnv *env,  jobject jObj, jstring jConsumerId, jboolean jAccepted)
 {
     LOGD (TAG,"JNIProviderService: nativeAcceptSubscription - IN");
     if (!jConsumerId)
     {
         ThrowNSException(JNI_INVALID_VALUE, "ConsumerId Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     const char *id = env->GetStringUTFChars( jConsumerId, NULL);
     std::string consumerId(id);
@@ -1169,21 +1175,21 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcce
         if (result !=  OIC::Service::NSResult::OK)
         {
             ThrowNSException((int) result, "Fail to  acceptSubscription");
-            return (jint) result;
+            return;
         }
     }
     LOGE (TAG,"Couldn't find consumer");
     ThrowNSException(JNI_NO_NATIVE_POINTER, "Fail to  find consumer");
-    return (jint) OIC::Service::NSResult::ERROR;
+    return;
 }
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeSetConsumerTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeSetConsumerTopic
 (JNIEnv *env, jobject jObj, jstring jConsumerId, jstring jTopicName)
 {
     LOGD (TAG,"JNIProviderService: nativeSetConsumerTopic - IN");
     if (!jConsumerId || !jTopicName)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Topic Name or ConsumerId Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     const char *name = env->GetStringUTFChars( jTopicName, NULL);
     const char *id = env->GetStringUTFChars( jConsumerId, NULL);
@@ -1194,27 +1200,28 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeSetC
     if (!nsConsumer)
     {
         ThrowNSException(JNI_NO_NATIVE_POINTER, "Consumer does exists");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     OIC::Service::NSResult result  = nsConsumer->setTopic(topicName);
 
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Select Topic");
+        return;
     }
     env->ReleaseStringUTFChars(jTopicName, name);
     env->ReleaseStringUTFChars(jConsumerId, id);
     LOGD (TAG,"JNIProviderService: nativeSetConsumerTopic - OUT");
-    return (jint) result;
+    return;
 }
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeUnsetConsumerTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeUnsetConsumerTopic
 (JNIEnv *env, jobject jObj, jstring jConsumerId, jstring jTopicName)
 {
     LOGD (TAG,"JNIProviderService: nativeUnsetConsumerTopic - IN");
     if (!jConsumerId || !jTopicName)
     {
         ThrowNSException(JNI_INVALID_VALUE, "Topic Name or ConsumerId Can't be NULL");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     const char *name = env->GetStringUTFChars( jTopicName, NULL);
     const char *id = env->GetStringUTFChars( jConsumerId, NULL);
@@ -1225,18 +1232,19 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeUnse
     if (!nsConsumer)
     {
         ThrowNSException(JNI_NO_NATIVE_POINTER, "Consumer does exists");
-        return (jint) OIC::Service::NSResult::ERROR;
+        return;
     }
     OIC::Service::NSResult result  = nsConsumer->unsetTopic(topicName);
 
     if (result !=  OIC::Service::NSResult::OK)
     {
         ThrowNSException((int) result, "Fail to  Unselect Topic");
+        return;
     }
     env->ReleaseStringUTFChars(jTopicName, name);
     env->ReleaseStringUTFChars(jConsumerId, id);
     LOGD (TAG,"JNIProviderService: nativeUnsetConsumerTopic - OUT");
-    return (jint) result;
+    return;
 }
 
 JNIEXPORT jobject JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeGetConsumerTopicList
index d72936d..f17d110 100755 (executable)
@@ -30,25 +30,25 @@ extern "C" {
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeStart
- * Signature: (Lorg/iotivity/service/ns/provider/ProviderService/OnConsumerSubscribedListener;Lorg/iotivity/service/ns/provider/ProviderService/OnMessageSynchronizedListener;ZLjava/lang/String;Z)I
+ * Signature: (Lorg/iotivity/service/ns/provider/ProviderService/OnConsumerSubscribedListener;Lorg/iotivity/service/ns/provider/ProviderService/OnMessageSynchronizedListener;ZLjava/lang/String;Z)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStart
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStart
 (JNIEnv *, jobject, jobject, jobject, jboolean, jstring, jboolean);
 
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeStop
- * Signature: ()I
+ * Signature: ()V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStop
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeStop
 (JNIEnv *, jobject);
 
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeSendMessage
- * Signature: (Lorg/iotivity/service/ns/common/Message;)I
+ * Signature: (Lorg/iotivity/service/ns/common/Message;)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeSendMessage
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeSendMessage
 (JNIEnv *, jobject, jobject);
 
 /*
@@ -70,44 +70,44 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_service_ns_provider_ProviderService_
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeEnableRemoteService
- * Signature: (Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_org_iotivity_service_ns_provider_ProviderService_nativeEnableRemoteService
 (JNIEnv *, jobject, jstring);
 
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeDisableRemoteService
- * Signature: (Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_org_iotivity_service_ns_provider_ProviderService_nativeDisableRemoteService
 (JNIEnv *, jobject, jstring);
 
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeSubscribeMQService
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
 Java_org_iotivity_service_ns_provider_ProviderService_nativeSubscribeMQService
 (JNIEnv *, jobject, jstring, jstring);
 
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeRegisterTopic
- * Signature: (Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeRegisterTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeRegisterTopic
 (JNIEnv *, jobject, jstring);
 
 /*
  * Class:     org_iotivity_service_ns_provider_ProviderService
  * Method:    nativeUnregisterTopic
- * Signature: (Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeUnregisterTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nativeUnregisterTopic
 (JNIEnv *, jobject, jstring);
 
 /*
@@ -122,25 +122,25 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeGetRegisteredTopicLi
 /*
  * Class:     org_iotivity_service_ns_provider_Consumer
  * Method:    nativeAcceptSubscription
- * Signature: (Ljava/lang/String;Z)I
+ * Signature: (Ljava/lang/String;Z)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcceptSubscription
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcceptSubscription
 (JNIEnv *, jobject, jstring, jboolean);
 
 /*
  * Class:     org_iotivity_service_ns_provider_Consumer
  * Method:    nativeSetConsumerTopic
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeSetConsumerTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeSetConsumerTopic
 (JNIEnv *, jobject, jstring, jstring);
 
 /*
  * Class:     org_iotivity_service_ns_provider_Consumer
  * Method:    nativeUnsetConsumerTopic
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
  */
-JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeUnsetConsumerTopic
+JNIEXPORT void JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeUnsetConsumerTopic
 (JNIEnv *, jobject, jstring, jstring);
 
 /*
index 992c8c5..11ef47a 100755 (executable)
@@ -28,6 +28,8 @@ import org.iotivity.base.PlatformConfig;
 import org.iotivity.base.QualityOfService;
 import org.iotivity.base.ServiceType;
 import org.iotivity.service.ns.common.Message;
+import org.iotivity.service.ns.common.NSException;
+import org.iotivity.service.ns.common.NSErrorCode;
 import org.iotivity.service.ns.common.Topic;
 import org.iotivity.service.ns.common.TopicsList;
 import org.iotivity.service.ns.common.SyncInfo;
@@ -429,8 +431,6 @@ public class ExampleUnitTest extends ApplicationTestCase<Application> {
         registerTopic("OIC_TOPIC1");
         assertEquals(true, response.get());
 
-        int result = 0;
-
         try {
             TopicsList list = mProvider.getTopicList();
             Iterator<Topic> it = list.getTopicsList().iterator();
@@ -438,11 +438,11 @@ public class ExampleUnitTest extends ApplicationTestCase<Application> {
                 Topic element = it.next();
                 element.setState(Topic.TopicState.SUBSCRIBED);
             }
-            result = mProvider.updateTopicList(list);
-        } catch (Exception e) {
+            mProvider.updateTopicList(list);
+        } catch (NSException e) {
             e.printStackTrace();
+            assertEquals(NSErrorCode.ERROR, e.getErrorCode());
         }
-        assertEquals(200, result);
     }
 
     @Test
old mode 100644 (file)
new mode 100755 (executable)
index 7190864..7a46eb8
@@ -43,10 +43,10 @@ class ProviderSimulator
     public void onConsumerSubscribed(Consumer consumer) {
         gConsumer = consumer;
         try {
-            int result = gConsumer.acceptSubscription(true);
-            Log.i(TAG, "Notification AcceptSubscription: " + result);
+            gConsumer.acceptSubscription(true);
+            Log.i(TAG, "Notification AcceptSubscription);
         } catch (Exception e) {
-
+            e.printStackTrace();
         }
     }
 
@@ -65,4 +65,4 @@ class ProviderSimulator
         return null;
     }
 
-}
\ No newline at end of file
+}
index bd21e4b..0e61948 100755 (executable)
@@ -113,17 +113,15 @@ public class ConsumerSample
         }
     }
 
-    public int subscribeMQService(String servAdd, String topicName) {
+    public void subscribeMQService(String servAdd, String topicName) {
         Log.i(TAG, "SubscribeMQService  - IN");
-        int result = 0;
         try {
-            result = consumerService.subscribeMQService(servAdd, topicName);
-            Log.i(TAG, "Notification SubscribeMQService: " + result);
+            consumerService.subscribeMQService(servAdd, topicName);
         } catch (Exception e) {
             Log.e(TAG, "Exception: subscribeMQService : " + e);
         }
         Log.i(TAG, "SubscribeMQService  - OUT");
-        return result;
+        return;
     }
 
     public void rescanProvider() {
index 6a0b960..5348d8b 100755 (executable)
@@ -371,10 +371,9 @@ public class MainActivity extends Activity
                             dialog.dismiss();
                             MQCloudAddress = ip.getText().toString();
                             MQCloudTopic = mqTopic.getText().toString();
-                            int result = mConsumerSample.subscribeMQService(
+                            mConsumerSample.subscribeMQService(
                                     MQCloudAddress, MQCloudTopic);
-                            TvLog.append("SubscribeMQService Result : " + result
-                                    + "\n");
+                            TvLog.append("SubscribeMQService success\n");
                         }
                     });
                     dialog.show();
old mode 100644 (file)
new mode 100755 (executable)
index cdd1ebf..701929b
@@ -30,6 +30,8 @@ import org.iotivity.base.OcPlatform;
 import org.iotivity.base.PlatformConfig;
 import org.iotivity.base.QualityOfService;
 import org.iotivity.base.ServiceType;
+import org.iotivity.service.ns.common.NSException;
+import org.iotivity.service.ns.common.NSErrorCode;
 import org.iotivity.service.ns.common.SyncInfo;
 import org.iotivity.service.ns.common.Topic;
 
@@ -152,38 +154,35 @@ public class ExampleUnitTest extends ApplicationTestCase<Application> {
 
     @Test
     public void StartProviderPositiveWithPolicyTrue() {
-        int result = 0;
         try {
-            result = gProviderRes.start(subCb, syncCb, true, "ok", false);
+            gProviderRes.start(subCb, syncCb, true, "ok", false);
             gProviderRes.stop();
-        } catch (Exception e) {
+        } catch (NSException e) {
             e.printStackTrace();
+            assertEquals(NSErrorCode.OK, e.getErrorCode());
         }
-        assertEquals(100, result);
     }
 
     @Test
     public void StartProviderPositiveWithPolicyFalse() {
-        int result = 0;
         try {
-            result = gProviderRes.start(subCb, syncCb, false, "ok", false);
+            gProviderRes.start(subCb, syncCb, false, "ok", false);
             gProviderRes.stop();
-        } catch (Exception e) {
+        } catch (NSException e) {
             e.printStackTrace();
+            assertEquals(NSErrorCode.OK, e.getErrorCode());
         }
-        assertEquals(100, result);
     }
 
     @Test
     public void StopProviderPositive() {
-        int result = 0;
         try {
             gProviderRes.start(subCb, syncCb, true, "ok", false);
-            result = gProviderRes.stop();
-        } catch (Exception e) {
+            gProviderRes.stop();
+        } catch (NSException e) {
             e.printStackTrace();
+            assertEquals(NSErrorCode.OK, e.getErrorCode());
         }
-        assertEquals(100, result);
     }
 
     @Test
old mode 100644 (file)
new mode 100755 (executable)
index ebfb568..b8ada11
@@ -377,22 +377,18 @@ public class MainActivity extends Activity
                     }
                     if (gRemoteService) {
                         TvLog.append("Enable Remote Service\n");
-                        int result = mProviderSample
-                                .enableRemoteService(RemoteAddress);
+                        mProviderSample.enableRemoteService(RemoteAddress);
                         remoteService.setText(R.string.disableRemoteService);
                         gRemoteService = false;
                         remoteService.setEnabled(true);
-                        TvLog.append("EnableRemoteService Result : " + result
-                                + "\n");
+                        TvLog.append("EnableRemoteService success \n");
                     } else {
                         TvLog.append("Disable Remote Service\n");
-                        int result = mProviderSample
-                                .disableRemoteService(RemoteAddress);
+                        mProviderSample.disableRemoteService(RemoteAddress);
                         remoteService.setText(R.string.enableRemoteService);
                         gRemoteService = true;
                         remoteService.setEnabled(true);
-                        TvLog.append("DisableRemoteService Result : " + result
-                                + "\n");
+                        TvLog.append("DisableRemoteService success\n");
                     }
                 }
                     break;
@@ -424,10 +420,9 @@ public class MainActivity extends Activity
                             dialog.dismiss();
                             MQCloudAddress = ip.getText().toString();
                             MQCloudTopic = mqTopic.getText().toString();
-                            int result = mProviderSample.subscribeMQService(
+                            mProviderSample.subscribeMQService(
                                     MQCloudAddress, MQCloudTopic);
-                            TvLog.append("SubscribeMQService Result : " + result
-                                    + "\n");
+                            TvLog.append("SubscribeMQService success\n");
                         }
                     });
                     dialog.show();
old mode 100644 (file)
new mode 100755 (executable)
index 051fa6a..57e5be3
@@ -96,54 +96,43 @@ public class ProviderSample
         configurePlatform();
         gAcceptor = policy;
         try {
-            int result = ioTNotification.start(this, this, policy, "Info",
-                    false);
-            Log.i(TAG, "Notification Start: " + result);
+            ioTNotification.start(this, this, policy, "Info", false);
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: start : " + e);
         }
-
         Log.i(TAG, "Start ProviderService - OUT");
     }
 
     public void registerTopic() {
         Log.i(TAG, "Register Topics -IN");
         try {
-            int result = ioTNotification.registerTopic("OCF_TOPIC1");
-            Log.i(TAG, " RegisterTopic: " + result);
-            result = ioTNotification.registerTopic("OCF_TOPIC2");
-            Log.i(TAG, " RegisterTopic: " + result);
-            result = ioTNotification.registerTopic("OCF_TOPIC3");
-            Log.i(TAG, " RegisterTopic: " + result);
-            result = ioTNotification.registerTopic("OCF_TOPIC4");
-            Log.i(TAG, " RegisterTopic: " + result);
+            ioTNotification.registerTopic("OCF_TOPIC1");
+            ioTNotification.registerTopic("OCF_TOPIC2");
+            ioTNotification.registerTopic("OCF_TOPIC3");
+            ioTNotification.registerTopic("OCF_TOPIC4");
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: registerTopic  : "+ e);
         }
 
         Log.i(TAG, "Start ProviderService - OUT");
     }
 
-    public int setTopic() {
+    public void setTopic() {
         Log.i(TAG, "Set Topic -IN");
         if (gConsumer == null) {
-            return 0;
+            return;
         }
         try {
-            int result = gConsumer.setTopic("OCF_TOPIC1");
-            Log.i(TAG, " Set Topic : " + result);
-            result = gConsumer.setTopic("OCF_TOPIC2");
-            Log.i(TAG, " Set Topic : " + result);
-            result = gConsumer.setTopic("OCF_TOPIC3");
-            Log.i(TAG, " Set Topic : " + result);
-            result = gConsumer.setTopic("OCF_TOPIC4");
-            Log.i(TAG, " Set Topic : " + result);
+            gConsumer.setTopic("OCF_TOPIC1");
+            gConsumer.setTopic("OCF_TOPIC2");
+            gConsumer.setTopic("OCF_TOPIC3");
+            gConsumer.setTopic("OCF_TOPIC4");
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: setTopic : " + e);
         }
 
-        Log.i(TAG, "Start ProviderService - OUT");
-        return 1;
+        Log.i(TAG, "setTopic ProviderService - OUT");
+        return;
     }
 
     public void stop() {
@@ -151,15 +140,12 @@ public class ProviderSample
         try {
             OcPlatform.stopPresence();
         } catch (Exception e) {
-            Log.e(TAG,
-                    "Exception: stopping presence when terminating NS server: "
-                            + e);
+            Log.e(TAG,"Exception: stopping presence when terminating NS server: "+ e);
         }
         try {
-            int result = ioTNotification.stop();
-            Log.i(TAG, "Notification Stop: " + result);
+            ioTNotification.stop();
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: stop : " + e);
         }
 
         Log.i(TAG, "Stop ProviderService - OUT");
@@ -169,10 +155,9 @@ public class ProviderSample
         Log.i(TAG, "SendMessage ProviderService - IN");
 
         try {
-            int result = ioTNotification.sendMessage(notiMessage);
-            Log.i(TAG, "Notification Send Message: " + result);
+            ioTNotification.sendMessage(notiMessage);
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: sendMessage : " + e);
         }
 
         Log.i(TAG, "SendMessage ProviderService - OUT");
@@ -193,7 +178,7 @@ public class ProviderSample
                     ioTNotification.sendSyncInfo(messageId, syncType);
                     Log.i(TAG, "Notification Sync ");
                 } catch (Exception e) {
-
+                    Log.e(TAG, "Exception: sendSyncInfo : " + e);
                 }
                 Log.i(TAG, "SendSyncInfo ProviderService - OUT");
                 msgMap.put("ID: " + messageId, SYNC_READ);
@@ -201,52 +186,45 @@ public class ProviderSample
         }
     }
 
-    public int enableRemoteService(String servAdd) {
+    public void enableRemoteService(String servAdd) {
         Log.i(TAG, "EnableRemoteService ProviderService - IN");
-        int result = 0;
         try {
-            result = ioTNotification.enableRemoteService(servAdd);
-            Log.i(TAG, "Notification EnableRemoteService: " + result);
+            ioTNotification.enableRemoteService(servAdd);
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: enableRemoteService : " + e);
         }
         Log.i(TAG, "EnableRemoteService ProviderService - OUT");
-        return result;
+        return;
     }
 
-    public int disableRemoteService(String servAdd) {
+    public void disableRemoteService(String servAdd) {
         Log.i(TAG, "DisableRemoteService ProviderService - IN");
-        int result = 0;
         try {
-            result = ioTNotification.disableRemoteService(servAdd);
-            Log.i(TAG, "Notification DisableRemoteService: " + result);
+            ioTNotification.disableRemoteService(servAdd);
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: disableRemoteService : " + e);
         }
         Log.i(TAG, "DisableRemoteService ProviderService - OUT");
-        return result;
+        return;
     }
 
-    public int subscribeMQService(String servAdd, String topicName) {
+    public void subscribeMQService(String servAdd, String topicName) {
         Log.i(TAG, "SubscribeMQService ProviderService - IN");
-        int result = 0;
         try {
-            result = ioTNotification.subscribeMQService(servAdd, topicName);
-            Log.i(TAG, "Notification SubscribeMQService: " + result);
+            ioTNotification.subscribeMQService(servAdd, topicName);
         } catch (Exception e) {
             Log.e(TAG, "Exception: subscribeMQService : " + e);
         }
         Log.i(TAG, "SubscribeMQService ProviderService - OUT");
-        return result;
+        return;
     }
 
     public void acceptSubscription(Consumer consumer, boolean accepted) {
         Log.i(TAG, "AcceptSubscription ProviderService - IN");
         try {
-            int result = consumer.acceptSubscription(accepted);
-            Log.i(TAG, "Notification AcceptSubscription: " + result);
+            consumer.acceptSubscription(accepted);
         } catch (Exception e) {
-
+            Log.e(TAG, "Exception: acceptSubscription : " + e);
         }
         Log.i(TAG, "AcceptSubscription ProviderService - OUT");
     }