[android] Addressed some minor SonarQube issues.
authorOssama Othman <ossama.othman@intel.com>
Tue, 11 Aug 2015 21:45:45 +0000 (14:45 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 11 Aug 2015 23:14:27 +0000 (23:14 +0000)
SonarQube flagged overly long lines, tabs in source code and lack of
braces in if-conditional blocks.  Fix some of those issues.

Change-Id: I7ac79dda519cbec220118d4a9e283d7ba64d626c
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2177
Reviewed-by: Tim Kourt <tim.a.kourt@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
android/android_api/base/jni/JniEntityHandler.cpp
android/android_api/base/jni/JniListenerManager.cpp [deleted file]
android/android_api/base/jni/JniOcPlatform.cpp

index 1ca14214e174969e0ea545c3db0a133038a0267d..b2cc8ce0c15ee6b5e321ac0f8f260b7b2c539589 100644 (file)
@@ -1,24 +1,23 @@
-/*
-* //******************************************************************
-* //
-* // Copyright 2015 Intel Corporation.
-* //
-* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-* //
-* // Licensed under the Apache License, Version 2.0 (the "License");
-* // you may not use this file except in compliance with the License.
-* // You may obtain a copy of the License at
-* //
-* //      http://www.apache.org/licenses/LICENSE-2.0
-* //
-* // Unless required by applicable law or agreed to in writing, software
-* // distributed under the License is distributed on an "AS IS" BASIS,
-* // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* // See the License for the specific language governing permissions and
-* // limitations under the License.
-* //
-* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-*/
+//******************************************************************
+//
+// Copyright 2015 Intel Corporation.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
 #include "JniEntityHandler.h"
 #include "JniOcResourceRequest.h"
 #include "JniOcResourceResponse.h"
@@ -36,60 +35,96 @@ JniEntityHandler::~JniEntityHandler()
     {
         jint ret;
         JNIEnv *env = GetJNIEnv(ret);
-        if (NULL == env) return;
+        if (NULL == env)
+        {
+            return;
+        }
         env->DeleteGlobalRef(m_jListener);
-        if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == ret)
+        {
+            g_jvm->DetachCurrentThread();
+        }
     }
 }
 
-OCEntityHandlerResult JniEntityHandler::handleEntity(const std::shared_ptr<OCResourceRequest> request)
+OCEntityHandlerResult JniEntityHandler::handleEntity(
+    const std::shared_ptr<OCResourceRequest> request)
 {
     LOGD("JniEntityHandler_handleEntity");
     jint envRet;
     JNIEnv *env = GetJNIEnv(envRet);
-    if (NULL == env) return OC_EH_ERROR;
+    if (NULL == env)
+    {
+        return OC_EH_ERROR;
+    }
 
     JniOcResourceRequest* jniResReq = new JniOcResourceRequest(request);
     jlong reqHandle = reinterpret_cast<jlong>(jniResReq);
-    jobject jResourceRequest = env->NewObject(g_cls_OcResourceRequest, g_mid_OcResourceRequest_N_ctor,
-        reqHandle);
+    jobject jResourceRequest =
+        env->NewObject(g_cls_OcResourceRequest,
+                       g_mid_OcResourceRequest_N_ctor,
+                       reqHandle);
     if (!jResourceRequest)
     {
         LOGE("Failed to create OcResourceRequest");
         delete jniResReq;
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
 
     jclass clsL = env->GetObjectClass(m_jListener);
     if (!clsL)
     {
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
     jmethodID midL = env->GetMethodID(clsL, "handleEntity",
         "(Lorg/iotivity/base/OcResourceRequest;)Lorg/iotivity/base/EntityHandlerResult;");
     if (!midL)
     {
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
     jobject entityHandlerResult = env->CallObjectMethod(m_jListener, midL, jResourceRequest);
     if (env->ExceptionCheck())
     {
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
     if (!entityHandlerResult)
     {
         ThrowOcException(JNI_INVALID_VALUE, "EntityHandlerResult cannot be null");
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
     jclass clsResult = env->GetObjectClass(entityHandlerResult);
     if (!clsResult)
     {
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
     jmethodID getValue_ID = env->GetMethodID(clsResult, "getValue", "()I");
@@ -102,10 +137,18 @@ OCEntityHandlerResult JniEntityHandler::handleEntity(const std::shared_ptr<OCRes
     if (env->ExceptionCheck())
     {
         LOGE("Java exception is thrown");
-        if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+        if (JNI_EDETACHED == envRet)
+        {
+            g_jvm->DetachCurrentThread();
+        }
+
         return OC_EH_ERROR;
     }
 
-    if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();
+    if (JNI_EDETACHED == envRet)
+    {
+        g_jvm->DetachCurrentThread();
+    }
+
     return JniUtils::getOCEntityHandlerResult(env, static_cast<int>(jResult));
-}
\ No newline at end of file
+}
diff --git a/android/android_api/base/jni/JniListenerManager.cpp b/android/android_api/base/jni/JniListenerManager.cpp
deleted file mode 100644 (file)
index b06be3b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-///*
-//* //******************************************************************
-//* //
-//* // Copyright 2015 Intel Corporation.
-//* //
-//* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//* //
-//* // Licensed under the Apache License, Version 2.0 (the "License");
-//* // you may not use this file except in compliance with the License.
-//* // You may obtain a copy of the License at
-//* //
-//* //      http://www.apache.org/licenses/LICENSE-2.0
-//* //
-//* // Unless required by applicable law or agreed to in writing, software
-//* // distributed under the License is distributed on an "AS IS" BASIS,
-//* // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//* // See the License for the specific language governing permissions and
-//* // limitations under the License.
-//* //
-//* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//*/
-//
-//#include "JniListenerManager.h"
-//
-//#include "JniOnGetListener.h"
-//
-//template<class T>
-//T* JniListenerManager<T>::addListener(JNIEnv* env, jobject jListener)
-//{
-//     T *onEventListener = NULL;
-//
-//     m_mapMutex.lock();
-//
-//     for (auto it = m_listenerMap.begin(); it != m_listenerMap.end(); ++it)
-//     {
-//             if (env->IsSameObject(jListener, it->first))
-//             {
-//                     auto refPair = it->second;
-//                     onEventListener = refPair.first;
-//                     refPair.second++;
-//                     it->second = refPair;
-//                     m_listenerMap.insert(*it);
-//                     LOGD("OnEventListener: ref. count is incremented");
-//                     break;
-//             }
-//     }
-//
-//     if (!onEventListener)
-//     {
-//             onEventListener = new T(env, jListener, this);
-//             jobject jgListener = env->NewGlobalRef(jListener);
-//
-//             m_listenerMap.insert(std::pair<jobject, std::pair<T*, int>>(jgListener, std::pair<T*, int>(onEventListener, 1)));
-//             LOGD("OnEventListener: new listener");
-//     }
-//
-//     m_mapMutex.unlock();
-//
-//     return onEventListener;
-//}
-//
-//template<class T>
-//void JniListenerManager<T>::removeListener(JNIEnv* env, jobject jListener)
-//{
-//     m_mapMutex.lock();
-//
-//     bool isFound = false;
-//
-//     for (auto it = m_listenerMap.begin(); it != m_listenerMap.end(); ++it)
-//     {
-//             if (env->IsSameObject(jListener, it->first))
-//             {
-//                     auto refPair = it->second;
-//                     if (refPair.second > 1)
-//                     {
-//                             refPair.second--;
-//                             it->second = refPair;
-//                             m_listenerMap.insert(*it);
-//                             LOGI("OnEventListener: ref. count is decremented");
-//                     }
-//                     else
-//                     {
-//                             env->DeleteGlobalRef(it->first);
-//                             T* listener = refPair.first;
-//                             delete listener;
-//                             m_listenerMap.erase(it);
-//
-//                             LOGI("OnEventListener is removed");
-//                     }
-//
-//                     isFound = true;
-//                     break;
-//             }
-//     }
-//
-//     if (!isFound)
-//     {
-//             ThrowOcException(JNI_EXCEPTION, "OnEventListener isn't found");
-//     }
-//
-//     m_mapMutex.unlock();
-//}
-//
index 3b67b6cd54ad4e00aa6d35ca8ee5db201e687c1c..8314e9e168e94a396172d34941381b12903c5094 100644 (file)
@@ -1,24 +1,23 @@
-/*
-* //******************************************************************
-* //
-* // Copyright 2015 Intel Corporation.
-* //
-* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-* //
-* // Licensed under the Apache License, Version 2.0 (the "License");
-* // you may not use this file except in compliance with the License.
-* // You may obtain a copy of the License at
-* //
-* //      http://www.apache.org/licenses/LICENSE-2.0
-* //
-* // Unless required by applicable law or agreed to in writing, software
-* // distributed under the License is distributed on an "AS IS" BASIS,
-* // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* // See the License for the specific language governing permissions and
-* // limitations under the License.
-* //
-* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-*/
+//******************************************************************
+//
+// Copyright 2015 Intel Corporation.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
 #include "JniOcPlatform.h"
 #include "OCPlatform.h"
 #include "JniOcResource.h"
@@ -36,7 +35,9 @@ JniOnResourceFoundListener* AddOnResourceFoundListener(JNIEnv* env, jobject jLis
 
     resourceFoundMapLock.lock();
 
-    for (auto it = onResourceFoundListenerMap.begin(); it != onResourceFoundListenerMap.end(); ++it)
+    for (auto it = onResourceFoundListenerMap.begin();
+         it != onResourceFoundListenerMap.end();
+         ++it)
     {
         if (env->IsSameObject(jListener, it->first))
         {
@@ -52,11 +53,16 @@ JniOnResourceFoundListener* AddOnResourceFoundListener(JNIEnv* env, jobject jLis
 
     if (!onResourceFoundListener)
     {
-        onResourceFoundListener = new JniOnResourceFoundListener(env, jListener, RemoveOnResourceFoundListener);
+        onResourceFoundListener =
+            new JniOnResourceFoundListener(env, jListener, RemoveOnResourceFoundListener);
         jobject jgListener = env->NewGlobalRef(jListener);
 
-        onResourceFoundListenerMap.insert(std::pair < jobject, std::pair < JniOnResourceFoundListener*,
-            int >> (jgListener, std::pair<JniOnResourceFoundListener*, int>(onResourceFoundListener, 1)));
+        onResourceFoundListenerMap.insert(
+            std::pair<jobject,
+                      std::pair<JniOnResourceFoundListener*, int >>(
+                          jgListener,
+                          std::pair<JniOnResourceFoundListener*, int>(onResourceFoundListener,
+                                                                      1)));
         LOGD("OnResourceFoundListener: new listener");
     }
     resourceFoundMapLock.unlock();
@@ -67,7 +73,9 @@ void RemoveOnResourceFoundListener(JNIEnv* env, jobject jListener)
 {
     resourceFoundMapLock.lock();
 
-    for (auto it = onResourceFoundListenerMap.begin(); it != onResourceFoundListenerMap.end(); ++it)
+    for (auto it = onResourceFoundListenerMap.begin();
+         it != onResourceFoundListenerMap.end();
+         ++it)
     {
         if (env->IsSameObject(jListener, it->first))
         {
@@ -115,11 +123,15 @@ JniOnDeviceInfoListener* AddOnDeviceInfoListener(JNIEnv* env, jobject jListener)
 
     if (!onDeviceInfoListener)
     {
-        onDeviceInfoListener = new JniOnDeviceInfoListener(env, jListener, RemoveOnDeviceInfoListener);
+        onDeviceInfoListener =
+            new JniOnDeviceInfoListener(env, jListener, RemoveOnDeviceInfoListener);
         jobject jgListener = env->NewGlobalRef(jListener);
 
-        onDeviceInfoListenerMap.insert(std::pair < jobject, std::pair < JniOnDeviceInfoListener*,
-            int >> (jgListener, std::pair<JniOnDeviceInfoListener*, int>(onDeviceInfoListener, 1)));
+        onDeviceInfoListenerMap.insert(
+            std::pair<jobject,
+                      std::pair<JniOnDeviceInfoListener*, int>>(
+                          jgListener,
+                          std::pair<JniOnDeviceInfoListener*, int>(onDeviceInfoListener, 1)));
         LOGI("OnDeviceInfoListener: new listener");
     }
 
@@ -187,11 +199,14 @@ JniOnPlatformInfoListener* AddOnPlatformInfoListener(JNIEnv* env, jobject jListe
 
     if (!onPlatformInfoListener)
     {
-        onPlatformInfoListener = new JniOnPlatformInfoListener(env, jListener, RemoveOnPlatformInfoListener);
+        onPlatformInfoListener =
+            new JniOnPlatformInfoListener(env, jListener, RemoveOnPlatformInfoListener);
         jobject jgListener = env->NewGlobalRef(jListener);
 
-        onPlatformInfoListenerMap.insert(std::pair < jobject, std::pair < JniOnPlatformInfoListener*,
-            int >> (jgListener, std::pair<JniOnPlatformInfoListener*, int>(onPlatformInfoListener, 1)));
+        onPlatformInfoListenerMap.insert(
+            std::pair<jobject, std::pair<JniOnPlatformInfoListener*, int>>(
+                jgListener,
+                std::pair<JniOnPlatformInfoListener*, int>(onPlatformInfoListener, 1)));
         LOGI("OnPlatformInfoListener: new listener");
     }
 
@@ -260,8 +275,10 @@ JniOnPresenceListener* AddOnPresenceListener(JNIEnv* env, jobject jListener)
     {
         onPresenceListener = new JniOnPresenceListener(env, jListener, RemoveOnPresenceListener);
         jobject jgListener = env->NewGlobalRef(jListener);
-        onPresenceListenerMap.insert(std::pair < jobject, std::pair < JniOnPresenceListener*,
-            int >> (jgListener, std::pair<JniOnPresenceListener*, int>(onPresenceListener, 1)));
+        onPresenceListenerMap.insert(
+            std::pair<jobject, std::pair<JniOnPresenceListener*, int>>(
+                jgListener,
+                std::pair<JniOnPresenceListener*, int>(onPresenceListener, 1)));
         LOGI("OnPresenceListener: new listener");
     }
     presenceMapLock.unlock();
@@ -363,7 +380,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyAllObservers0
 
     try
     {
-        OCStackResult result = OCPlatform::notifyAllObservers(jniOcResourceHandle->getOCResourceHandle());
+        OCStackResult result =
+            OCPlatform::notifyAllObservers(jniOcResourceHandle->getOCResourceHandle());
 
         if (OC_STACK_OK != result)
         {
@@ -394,9 +412,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyAllObservers1
         return;
     }
 
-    JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    JniOcResourceHandle* jniOcResourceHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
     try{
         OCStackResult result = OCPlatform::notifyAllObservers(
@@ -421,8 +442,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyAllObservers1
 * Method:    notifyListOfObservers2
 * Signature: (Lorg/iotivity/base/OcResourceHandle;[Ljava/lang/Byte;Lorg/iotivity/base/OcResourceResponse;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2
-(JNIEnv *env, jclass clazz, jobject jResourceHandle, jbyteArray jObservationIdArr, jobject jResourceResponse)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2(
+    JNIEnv *env,
+    jclass clazz,
+    jobject jResourceHandle,
+    jbyteArray jObservationIdArr,
+    jobject jResourceResponse)
 {
     LOGD("OcPlatform_notifyListOfObservers2");
     if (!jResourceHandle)
@@ -441,13 +466,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2
         return;
     }
 
-    JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    JniOcResourceHandle* jniOcResourceHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
-    JniOcResourceResponse* jniOcResourceResponse = JniOcResourceResponse::getJniOcResourceResponsePtr(
-        env, jResourceResponse);
-    if (!jniOcResourceResponse) return;
+    JniOcResourceResponse* jniOcResourceResponse =
+        JniOcResourceResponse::getJniOcResourceResponsePtr(env, jResourceResponse);
+    if (!jniOcResourceResponse)
+    {
+        return;
+    }
 
     int len = env->GetArrayLength(jObservationIdArr);
     uint8_t* bArr = (uint8_t*)env->GetByteArrayElements(jObservationIdArr, 0);
@@ -460,7 +491,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2
 
     env->ReleaseByteArrayElements(jObservationIdArr, (jbyte*)bArr, 0);
 
-    try{
+    try
+    {
         OCStackResult result = OCPlatform::notifyListOfObservers(
             jniOcResourceHandle->getOCResourceHandle(),
             observationIds,
@@ -483,8 +515,13 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2
 * Method:    notifyListOfObservers3
 * Signature: (Lorg/iotivity/base/OcResourceHandle;[Ljava/lang/Byte;Lorg/iotivity/base/OcResourceResponse;I)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3
-(JNIEnv *env, jclass clazz, jobject jResourceHandle, jbyteArray jObservationIdArr, jobject jResourceResponse, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3(
+    JNIEnv *env,
+    jclass clazz,
+    jobject jResourceHandle,
+    jbyteArray jObservationIdArr,
+    jobject jResourceResponse,
+    jint jQoS)
 {
     LOGD("OcPlatform_notifyListOfObservers3");
     if (!jResourceHandle)
@@ -503,13 +540,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3
         return;
     }
 
-    JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    JniOcResourceHandle* jniOcResourceHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
-    JniOcResourceResponse* jniOcResourceResponse = JniOcResourceResponse::getJniOcResourceResponsePtr(
-        env, jResourceResponse);
-    if (!jniOcResourceResponse) return;
+    JniOcResourceResponse* jniOcResourceResponse =
+        JniOcResourceResponse::getJniOcResourceResponsePtr(env, jResourceResponse);
+    if (!jniOcResourceResponse)
+    {
+        return;
+    }
 
     int len = env->GetArrayLength(jObservationIdArr);
     uint8_t* bArr = (uint8_t*)env->GetByteArrayElements(jObservationIdArr, 0);
@@ -522,7 +565,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3
 
     env->ReleaseByteArrayElements(jObservationIdArr, (jbyte*)bArr, 0);
 
-    try{
+    try
+    {
         OCStackResult result = OCPlatform::notifyListOfObservers(
             jniOcResourceHandle->getOCResourceHandle(),
             observationIds,
@@ -546,8 +590,13 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3
 * Method:    findResource0
 * Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnResourceFoundListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceUri,
+    jint jConnectivityType,
+    jobject jListener)
 {
     LOGD("OcPlatform_findResource");
     std::string host;
@@ -599,8 +648,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource0
 * Method:    findResource1
 * Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnResourceFoundListener;I)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource1(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceUri,
+    jint jConnectivityType,
+    jobject jListener,
+    jint jQoS)
 {
     LOGD("OcPlatform_findResource");
     std::string host;
@@ -652,8 +707,13 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource1
 * Method:    getDeviceInfo0
 * Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnDeviceFoundListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceUri,
+    jint jConnectivityType,
+    jobject jListener)
 {
     LOGD("OcPlatform_getDeviceInfo0");
     std::string host;
@@ -673,10 +733,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo0
     }
     JniOnDeviceInfoListener *onDeviceInfoListener = AddOnDeviceInfoListener(env, jListener);
 
-    FindDeviceCallback findDeviceCallback = [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
-    {
-        onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
-    };
+    FindDeviceCallback findDeviceCallback =
+        [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
+        {
+            onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
+        };
 
     try
     {
@@ -703,8 +764,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo0
 * Method:    getDeviceInfo1
 * Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnDeviceFoundListener;I)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo1(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceUri,
+    jint jConnectivityType,
+    jobject jListener,
+    jint jQoS)
 {
     LOGD("OcPlatform_getDeviceInfo1");
     std::string host;
@@ -724,10 +791,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo1
     }
     JniOnDeviceInfoListener *onDeviceInfoListener = AddOnDeviceInfoListener(env, jListener);
 
-    FindDeviceCallback findDeviceCallback = [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
-    {
-        onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
-    };
+    FindDeviceCallback findDeviceCallback =
+        [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
+        {
+            onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
+        };
 
     try
     {
@@ -755,8 +823,13 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo1
 * Method:    getPlatformInfo0
 * Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnPlatformFoundListener;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceUri,
+    jint jConnectivityType,
+    jobject jListener)
 {
     LOGD("OcPlatform_getPlatformInfo0");
     std::string host;
@@ -776,10 +849,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo0
     }
     JniOnPlatformInfoListener *onPlatformInfoListener = AddOnPlatformInfoListener(env, jListener);
 
-    FindPlatformCallback findPlatformCallback = [onPlatformInfoListener](const OCRepresentation& ocRepresentation)
-    {
-        onPlatformInfoListener->foundPlatformCallback(ocRepresentation);
-    };
+    FindPlatformCallback findPlatformCallback =
+        [onPlatformInfoListener](const OCRepresentation& ocRepresentation)
+        {
+            onPlatformInfoListener->foundPlatformCallback(ocRepresentation);
+        };
 
     try
     {
@@ -806,8 +880,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo0
 * Method:    getPlatformInfo1
 * Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnPlatformFoundListener;I)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo1(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceUri,
+    jint jConnectivityType,
+    jobject jListener,
+    jint jQoS)
 {
     LOGD("OcPlatform_getPlatformInfo1");
     std::string host;
@@ -827,10 +907,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo1
     }
     JniOnDeviceInfoListener *onDeviceInfoListener = AddOnDeviceInfoListener(env, jListener);
 
-    FindDeviceCallback findDeviceCallback = [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
-    {
-        onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
-    };
+    FindDeviceCallback findDeviceCallback =
+        [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
+        {
+            onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
+        };
 
     try
     {
@@ -858,8 +939,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo1
 * Method:    registerResource0
 * Signature: (Lorg/iotivity/base/OcResource;)Lorg/iotivity/base/OcResourceHandle;
 */
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource0
-(JNIEnv *env, jclass clazz, jobject jResource)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource0(
+    JNIEnv *env, jclass clazz, jobject jResource)
 {
     LOGD("OcPlatform_registerResource");
     if (!jResource)
@@ -890,7 +971,8 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource0
     }
     JniOcResourceHandle* jniHandle = new JniOcResourceHandle(resourceHandle);
     jlong handle = reinterpret_cast<jlong>(jniHandle);
-    jobject jResourceHandle = env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
+    jobject jResourceHandle =
+        env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
 
     if (!jResourceHandle)
     {
@@ -905,8 +987,12 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource0
 * Method:    registerResource1
 * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcPlatform/EntityHandler;I)Lorg/iotivity/base/OcResourceHandle;
 */
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource1
-(JNIEnv *env, jclass clazz, jstring jResourceUri, jstring jResourceTypeName, jstring jResourceInterface,
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource1(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jResourceUri,
+    jstring jResourceTypeName,
+    jstring jResourceInterface,
 jobject jListener, jint jResourceProperty)
 {
     LOGI("OcPlatform_registerResource1");
@@ -931,10 +1017,11 @@ jobject jListener, jint jResourceProperty)
         return nullptr;
     }
     JniEntityHandler* entityHandler = new JniEntityHandler(env, jListener);
-    EntityHandler handleEntityCallback = [entityHandler](const std::shared_ptr<OCResourceRequest> request) ->
-        OCEntityHandlerResult{
-        return entityHandler->handleEntity(request);
-    };
+    EntityHandler handleEntityCallback =
+        [entityHandler](const std::shared_ptr<OCResourceRequest> request) -> OCEntityHandlerResult
+        {
+            return entityHandler->handleEntity(request);
+        };
 
     OCResourceHandle resourceHandle;
     try
@@ -964,7 +1051,8 @@ jobject jListener, jint jResourceProperty)
 
     JniOcResourceHandle* jniHandle = new JniOcResourceHandle(resourceHandle);
     jlong handle = reinterpret_cast<jlong>(jniHandle);
-    jobject jResourceHandle = env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
+    jobject jResourceHandle =
+        env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
     if (!jResourceHandle)
     {
         LOGE("Failed to create OcResourceHandle");
@@ -979,10 +1067,10 @@ jobject jListener, jint jResourceProperty)
 * Method:    registerDeviceInfo0
 * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerDeviceInfo0
-(JNIEnv *env,
-jclass clazz,
-jstring jDeviceName)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerDeviceInfo0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jDeviceName)
 {
     LOGI("OcPlatform_registerDeviceInfo");
 
@@ -1027,20 +1115,20 @@ jstring jDeviceName)
 * Method:    registerPlatformInfo0
 * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerPlatformInfo0
-(JNIEnv *env,
-jclass clazz,
-jstring jPlatformID,
-jstring jManufacturerName,
-jstring jManufacturerUrl,
-jstring jModelNumber,
-jstring jDateOfManufacture,
-jstring jPlatformVersion,
-jstring jOperatingSystemVersion,
-jstring jHardwareVersion,
-jstring jFirmwareVersion,
-jstring jSupportUrl,
-jstring jSystemTime)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerPlatformInfo0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jPlatformID,
+    jstring jManufacturerName,
+    jstring jManufacturerUrl,
+    jstring jModelNumber,
+    jstring jDateOfManufacture,
+    jstring jPlatformVersion,
+    jstring jOperatingSystemVersion,
+    jstring jHardwareVersion,
+    jstring jFirmwareVersion,
+    jstring jSupportUrl,
+    jstring jSystemTime)
 {
     LOGI("OcPlatform_registerPlatformInfo");
 
@@ -1151,9 +1239,6 @@ jstring jSystemTime)
             LOGE("Error is due to %s", e.reason().c_str());
             ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
         }
-
-
-
 }
 
 /*
@@ -1161,8 +1246,8 @@ jstring jSystemTime)
 * Method:    unregisterResource0
 * Signature: (Lorg/iotivity/base/OcResourceHandle;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unregisterResource0
-(JNIEnv *env, jclass clazz, jobject jResourceHandle)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unregisterResource0(
+    JNIEnv *env, jclass clazz, jobject jResourceHandle)
 {
     LOGI("OcPlatform_unregisterResource");
     if (!jResourceHandle)
@@ -1172,7 +1257,10 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unregisterResource0
     }
     JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
         env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
     try
     {
@@ -1209,13 +1297,16 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResource0
         ThrowOcException(OC_STACK_INVALID_PARAM, "resourceHandle cannot be null");
         return;
     }
-    JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceCollectionHandle);
+    JniOcResourceHandle* jniOcResourceCollectionHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
     if (!jniOcResourceCollectionHandle) return;
 
     JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
         env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
     try
     {
@@ -1241,8 +1332,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResource0
 * Method:    bindResources0
 * Signature: (Lorg/iotivity/base/OcResourceHandle;[Lorg/iotivity/base/OcResourceHandle;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0
-(JNIEnv *env, jclass clazz, jobject jResourceCollectionHandle, jobjectArray jResourceHandleArray)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0(
+    JNIEnv *env,
+    jclass clazz,
+    jobject jResourceCollectionHandle,
+    jobjectArray jResourceHandleArray)
 {
     LOGI("OcPlatform_bindResources");
 
@@ -1257,9 +1351,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0
         return;
     }
 
-    JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceCollectionHandle);
-    if (!jniOcResourceCollectionHandle) return;
+    JniOcResourceHandle* jniOcResourceCollectionHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
+    if (!jniOcResourceCollectionHandle)
+    {
+        return;
+    }
 
     std::vector<OCResourceHandle> resourceHandleList;
     int len = env->GetArrayLength(jResourceHandleArray);
@@ -1272,9 +1369,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0
             return;
         }
 
-        JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-            env, jResourceHandle);
-        if (!jniOcResourceHandle) return;
+        JniOcResourceHandle* jniOcResourceHandle =
+            JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+        if (!jniOcResourceHandle)
+        {
+            return;
+        }
 
         resourceHandleList.push_back(
             jniOcResourceHandle->getOCResourceHandle());
@@ -1304,8 +1404,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0
 * Method:    unbindResource0
 * Signature: (Lorg/iotivity/base/OcResourceHandle;Lorg/iotivity/base/OcResourceHandle;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResource0
-(JNIEnv *env, jclass clazz, jobject jResourceCollectionHandle, jobject jResourceHandle)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResource0(
+    JNIEnv *env,
+    jclass clazz,
+    jobject jResourceCollectionHandle,
+    jobject jResourceHandle)
 {
     LOGI("OcPlatform_unbindResource");
     if (!jResourceCollectionHandle)
@@ -1319,20 +1422,25 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResource0
         return;
     }
 
-    JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceCollectionHandle);
-    if (!jniOcResourceCollectionHandle) return;
+    JniOcResourceHandle* jniOcResourceCollectionHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
+    if (!jniOcResourceCollectionHandle)
+    {
+        return;
+    }
 
-    JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    JniOcResourceHandle* jniOcResourceHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
     try
     {
         OCStackResult result = OCPlatform::unbindResource(
             jniOcResourceCollectionHandle->getOCResourceHandle(),
-            jniOcResourceHandle->getOCResourceHandle()
-            );
+            jniOcResourceHandle->getOCResourceHandle());
 
         if (OC_STACK_OK != result)
         {
@@ -1351,8 +1459,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResource0
 * Method:    unbindResources0
 * Signature: (Lorg/iotivity/base/OcResourceHandle;[Lorg/iotivity/base/OcResourceHandle;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0
-(JNIEnv *env, jclass clazz, jobject jResourceCollectionHandle, jobjectArray jResourceHandleArray)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0(
+    JNIEnv *env,
+    jclass clazz,
+    jobject jResourceCollectionHandle,
+    jobjectArray jResourceHandleArray)
 {
     LOGI("OcPlatform_unbindResources");
     if (!jResourceCollectionHandle)
@@ -1366,9 +1477,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0
         return;
     }
 
-    JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceCollectionHandle);
-    if (!jniOcResourceCollectionHandle) return;
+    JniOcResourceHandle* jniOcResourceCollectionHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
+    if (!jniOcResourceCollectionHandle)
+    {
+        return;
+    }
 
     std::vector<OCResourceHandle> resourceHandleList;
     int len = env->GetArrayLength(jResourceHandleArray);
@@ -1381,9 +1495,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0
             return;
         }
 
-        JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-            env, jResourceHandle);
-        if (!jniOcResourceHandle) return;
+        JniOcResourceHandle* jniOcResourceHandle =
+            JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+        if (!jniOcResourceHandle)
+        {
+            return;
+        }
 
         resourceHandleList.push_back(
             jniOcResourceHandle->getOCResourceHandle());
@@ -1413,8 +1530,11 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0
 * Method:    bindTypeToResource0
 * Signature: (Lorg/iotivity/base/OcResourceHandle;Ljava/lang/String;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindTypeToResource0
-(JNIEnv *env, jclass clazz, jobject jResourceHandle, jstring jResourceTypeName)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindTypeToResource0(
+    JNIEnv *env,
+    jclass clazz,
+    jobject jResourceHandle,
+    jstring jResourceTypeName)
 {
     LOGI("OcPlatform_bindTypeToResource");
     if (!jResourceHandle)
@@ -1428,8 +1548,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindTypeToResource0
         typeName = env->GetStringUTFChars(jResourceTypeName, NULL);
     }
 
-    JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceHandle);
+    JniOcResourceHandle* jniOcResourceHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
     if (!jniOcResourceHandle) return;
 
     try
@@ -1471,9 +1591,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindInterfaceToResource
         interfaceName = env->GetStringUTFChars(jResourceInterfaceName, NULL);
     }
 
-    JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
-        env, jResourceHandle);
-    if (!jniOcResourceHandle) return;
+    JniOcResourceHandle* jniOcResourceHandle =
+        JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+    if (!jniOcResourceHandle)
+    {
+        return;
+    }
 
     try
     {
@@ -1499,8 +1622,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindInterfaceToResource
 * Method:    startPresence0
 * Signature: (I)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_startPresence0
-(JNIEnv *env, jclass clazz, jint ttl)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_startPresence0(
+    JNIEnv *env, jclass clazz, jint ttl)
 {
     LOGI("OcPlatform_startPresence");
 
@@ -1525,8 +1648,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_startPresence0
 * Method:    stopPresence0
 * Signature: ()V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_stopPresence0
-(JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_stopPresence0(
+    JNIEnv *env, jclass clazz)
 {
     LOGI("OcPlatform_stopPresence");
 
@@ -1551,8 +1674,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_stopPresence0
 * Method:    subscribePresence0
 * Signature: (Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnPresenceListener;)Lorg/iotivity/base/OcPresenceHandle;
 */
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0
-(JNIEnv *env, jclass clazz, jstring jHost, jint jConnectivityType, jobject jListener)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jint jConnectivityType,
+    jobject jListener)
 {
     LOGD("OcPlatform_subscribePresence");
     std::string host;
@@ -1568,11 +1695,13 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0
 
     JniOnPresenceListener *onPresenceListener = AddOnPresenceListener(env, jListener);
 
-    SubscribeCallback subscribeCallback = [onPresenceListener](OCStackResult result, const unsigned int nonce,
-        const std::string& hostAddress)
-    {
-        onPresenceListener->onPresenceCallback(result, nonce, hostAddress);
-    };
+    SubscribeCallback subscribeCallback =
+        [onPresenceListener](OCStackResult result,
+                             const unsigned int nonce,
+                             const std::string& hostAddress)
+        {
+            onPresenceListener->onPresenceCallback(result, nonce, hostAddress);
+        };
 
     OCPlatform::OCPresenceHandle presenceHandle;
     try
@@ -1595,9 +1724,11 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0
         return nullptr;
     }
 
-    JniOcPresenceHandle* jniPresenceHandle = new JniOcPresenceHandle(onPresenceListener, presenceHandle);
+    JniOcPresenceHandle* jniPresenceHandle =
+        new JniOcPresenceHandle(onPresenceListener, presenceHandle);
     jlong jhandle = reinterpret_cast<jlong>(jniPresenceHandle);
-    jobject jPresenceHandle = env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
+    jobject jPresenceHandle =
+        env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
     if (!jPresenceHandle)
     {
         LOGE("Failed to create OcPresenceHandle");
@@ -1612,8 +1743,13 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0
 * Signature: (Ljava/lang/String;Ljava/lang/String;I
 Lorg/iotivity/base/OcPlatform/OnPresenceListener;)Lorg/iotivity/base/OcPresenceHandle;
 */
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceType, jint jConnectivityType, jobject jListener)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence1(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jResourceType,
+    jint jConnectivityType,
+    jobject jListener)
 {
     LOGD("OcPlatform_subscribePresence1");
     std::string host;
@@ -1662,9 +1798,11 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence1
         return nullptr;
     }
 
-    JniOcPresenceHandle* jniPresenceHandle = new JniOcPresenceHandle(onPresenceListener, presenceHandle);
+    JniOcPresenceHandle* jniPresenceHandle =
+        new JniOcPresenceHandle(onPresenceListener, presenceHandle);
     jlong jhandle = reinterpret_cast<jlong>(jniPresenceHandle);
-    jobject jPresenceHandle = env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
+    jobject jPresenceHandle =
+        env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
     if (!jPresenceHandle)
     {
         LOGE("Failed to create OcPresenceHandle");
@@ -1678,8 +1816,8 @@ JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence1
 * Method:    unsubscribePresence0
 * Signature: (Lorg/iotivity/base/OcPresenceHandle;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0
-(JNIEnv *env, jclass clazz, jobject jPresenceHandle)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0(
+    JNIEnv *env, jclass clazz, jobject jPresenceHandle)
 {
     LOGD("OcPlatform_unsubscribePresence");
     if (!jPresenceHandle)
@@ -1687,8 +1825,12 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0
         ThrowOcException(OC_STACK_INVALID_PARAM, "presenceHandle cannot be null");
         return;
     }
-    JniOcPresenceHandle* jniPresenceHandle = JniOcPresenceHandle::getJniOcPresenceHandlePtr(env, jPresenceHandle);
-    if (!jniPresenceHandle) return;
+    JniOcPresenceHandle* jniPresenceHandle =
+        JniOcPresenceHandle::getJniOcPresenceHandlePtr(env, jPresenceHandle);
+    if (!jniPresenceHandle)
+    {
+        return;
+    }
 
     OCPresenceHandle presenceHandle = jniPresenceHandle->getOCPresenceHandle();
 
@@ -1701,7 +1843,8 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0
             ThrowOcException(result, "unsubscribe presence has failed");
             return;
         }
-        jweak jwOnPresenceListener = jniPresenceHandle->getJniOnPresenceListener()->getJWListener();
+        jweak jwOnPresenceListener =
+            jniPresenceHandle->getJniOnPresenceListener()->getJWListener();
         if (jwOnPresenceListener)
         {
             RemoveOnPresenceListener(env, jwOnPresenceListener);
@@ -1720,9 +1863,15 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0
 * Signature: (Ljava/lang/String;Ljava/lang/String;IZ[Ljava/lang/String;[Ljava/lang/String;)
 Lorg/iotivity/base/OcResource;
 */
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_constructResourceObject0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jUri, jint jConnectivityType,
-jboolean jIsObservable, jobjectArray jResourceTypeArray, jobjectArray jInterfaceArray)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_constructResourceObject0(
+    JNIEnv *env,
+    jclass clazz,
+    jstring jHost,
+    jstring jUri,
+    jint jConnectivityType,
+    jboolean jIsObservable,
+    jobjectArray jResourceTypeArray,
+    jobjectArray jInterfaceArray)
 {
     LOGD("OcPlatform_constructResourceObject");
     std::string host;
@@ -1789,8 +1938,8 @@ jboolean jIsObservable, jobjectArray jResourceTypeArray, jobjectArray jInterface
 * Method:    sendResponse0
 * Signature: (Lorg/iotivity/base/OcResourceResponse;)V
 */
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_sendResponse0
-(JNIEnv *env, jclass clazz, jobject jResourceResponse)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_sendResponse0(
+    JNIEnv *env, jclass clazz, jobject jResourceResponse)
 {
     LOGD("OcPlatform_sendResponse");
     if (!jResourceResponse)
@@ -1799,13 +1948,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_sendResponse0
         return;
     }
 
-    JniOcResourceResponse *jniResponse = JniOcResourceResponse::getJniOcResourceResponsePtr(
-        env, jResourceResponse);
+    JniOcResourceResponse *jniResponse =
+        JniOcResourceResponse::getJniOcResourceResponsePtr(env, jResourceResponse);
     if (!jniResponse) return;
 
     try
     {
-        OCStackResult result = OCPlatform::sendResponse(jniResponse->getOCResourceResponse());
+        OCStackResult result =
+            OCPlatform::sendResponse(jniResponse->getOCResourceResponse());
 
         if (OC_STACK_OK != result)
         {