Rename resource-encapsulation exception classes.
authorcoderhyme <jhyo.kim@samsung.com>
Mon, 21 Sep 2015 06:25:15 +0000 (23:25 -0700)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 21 Sep 2015 10:19:36 +0000 (10:19 +0000)
It is to make class names consistent.
All exposed classes in resource-encapsultion layer as the API must start with RCS.

Change-Id: I64280bc959a60d368cfabab731196e35a7383a94
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2817
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
33 files changed:
service/notification-manager/NotificationManager/src/HostingObject.cpp
service/notification-manager/NotificationManager/src/ResourceHosting.cpp
service/notification-manager/NotificationManager/src/hosting.cpp
service/resource-encapsulation/android/service/src/main/jni/JniRcsDiscoveryManager.cpp
service/resource-encapsulation/android/service/src/main/jni/JniRcsRemoteResourceObject.cpp
service/resource-encapsulation/android/service/src/main/jni/JniRcsResourceObject.cpp
service/resource-encapsulation/android/service/src/main/jni/util/JavaExceptions.cpp
service/resource-encapsulation/android/service/src/main/jni/util/JavaExceptions.h
service/resource-encapsulation/examples/linux/NestedAttributeServer.cpp
service/resource-encapsulation/examples/linux/SampleResourceClient.cpp
service/resource-encapsulation/examples/linux/SampleResourceServer.cpp
service/resource-encapsulation/examples/tizen/NestedAttributeServerApp/src/reserver.cpp
service/resource-encapsulation/examples/tizen/RESampleClientApp/src/reclient.cpp
service/resource-encapsulation/examples/tizen/RESampleServerApp/src/reserver.cpp
service/resource-encapsulation/include/RCSException.h
service/resource-encapsulation/include/RCSResourceAttributes.h
service/resource-encapsulation/src/common/expiryTimer/src/ExpiryTimerImpl.cpp
service/resource-encapsulation/src/common/primitiveResource/include/AssertUtils.h
service/resource-encapsulation/src/common/primitiveResource/src/RCSException.cpp
service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp
service/resource-encapsulation/src/common/primitiveResource/unittests/PresenceSubscriberTest.cpp
service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp
service/resource-encapsulation/src/common/primitiveResource/unittests/ResourceAttributesTest.cpp
service/resource-encapsulation/src/resourceBroker/include/ResourceBroker.h
service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp
service/resource-encapsulation/src/resourceBroker/src/ResourceBroker.cpp
service/resource-encapsulation/src/resourceBroker/unittest/DevicePresenceUnitTest.cpp
service/resource-encapsulation/src/resourceClient/RCSDiscoveryManagerImpl.cpp
service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp
service/resource-encapsulation/src/resourceContainer/src/DiscoverResourceUnit.cpp
service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp
service/resource-encapsulation/src/serverBuilder/unittests/RCSResourceObjectTest.cpp
service/resource-encapsulation/unittests/ResourceClientTest.cpp

index 3cb127e..3c0a1c3 100644 (file)
@@ -111,7 +111,7 @@ void HostingObject::stateChangedCB(ResourceState state, RemoteObjectPtr rObject)
             try
             {
                 rObject->startCaching(pDataUpdateCB);
-            }catch(InvalidParameterException &e)
+            }catch(const RCSInvalidParameterException &e)
             {
                 OIC_HOSTING_LOG(DEBUG,
                         "[HostingObject::stateChangedCB]startCaching InvalidParameterException:%s",
@@ -128,7 +128,7 @@ void HostingObject::stateChangedCB(ResourceState state, RemoteObjectPtr rObject)
             try
             {
                 rObject->stopCaching();
-            }catch(InvalidParameterException &e)
+            }catch(const RCSInvalidParameterException &e)
             {
                 OIC_HOSTING_LOG(DEBUG,
                         "[HostingObject::stateChangedCB]stopCaching InvalidParameterException:%s",
@@ -140,7 +140,7 @@ void HostingObject::stateChangedCB(ResourceState state, RemoteObjectPtr rObject)
             try
             {
                 rObject->stopMonitoring();
-            }catch(InvalidParameterException &e)
+            }catch(const RCSInvalidParameterException &e)
             {
                 OIC_HOSTING_LOG(DEBUG,
                         "[HostingObject::stateChangedCB]stopWatching InvalidParameterException:%s",
@@ -170,7 +170,7 @@ void HostingObject::dataChangedCB(const RCSResourceAttributes & attributes, Remo
         try
         {
             mirroredServer = createMirroredServer(rObject);
-        }catch(PlatformException &e)
+        }catch(const RCSPlatformException &e)
         {
             OIC_HOSTING_LOG(DEBUG,
                         "[HostingObject::dataChangedCB]createMirroredServer PlatformException:%s",
@@ -237,7 +237,7 @@ HostingObject::ResourceObjectPtr HostingObject::createMirroredServer(RemoteObjec
     }
     else
     {
-        throw PlatformException(OC_STACK_ERROR);
+        throw RCSPlatformException(OC_STACK_ERROR);
     }
 
     return retResource;
@@ -252,7 +252,7 @@ RCSSetResponse HostingObject::setRequestHandler(const RCSRequest & primitiveRequ
         RequestObject newRequest = { };
         newRequest.invokeRequest(remoteObject, RequestObject::RequestMethod::Setter,
                 resourceAttibutes);
-    }catch(PlatformException &e)
+    }catch(const RCSPlatformException &e)
     {
         OIC_HOSTING_LOG(DEBUG,
                 "[HostingObject::setRequestHandler] PlatformException:%s",
index a940417..0f05cbd 100644 (file)
@@ -69,17 +69,17 @@ void ResourceHosting::startHosting()
     {
         requestMulticastPresence();
         requestMulticastDiscovery();
-    }catch(PlatformException &e)
+    }catch(const RCSPlatformException &e)
     {
         OIC_HOSTING_LOG(DEBUG,
                 "[ResourceHosting::startHosting]PlatformException:%s", e.what());
         throw;
-    }catch(InvalidParameterException &e)
+    }catch(const RCSInvalidParameterException &e)
     {
         OIC_HOSTING_LOG(DEBUG,
                 "[ResourceHosting::startHosting]InvalidParameterException:%s", e.what());
         throw;
-    }catch(std::exception &e)
+    }catch(const std::exception &e)
     {
         OIC_HOSTING_LOG(DEBUG,
                 "[ResourceHosting::startHosting]std::exception:%s", e.what());
@@ -206,7 +206,7 @@ void ResourceHosting::discoverHandler(RemoteObjectPtr remoteResource)
                     std::bind(&ResourceHosting::destroyedHostingObject, this,
                             HostingObjectWeakPtr(foundHostingObject)));
             hostingObjectList.push_back(foundHostingObject);
-        }catch(InvalidParameterException &e)
+        }catch(const RCSInvalidParameterException &e)
         {
             OIC_HOSTING_LOG(DEBUG,
                     "[ResourceHosting::discoverHandler]InvalidParameterException:%s", e.what());
index d222795..3d0ccfa 100644 (file)
@@ -38,13 +38,13 @@ OCStackResult OICStartCoordinate()
     try
     {
         ResourceHosting::getInstance()->startHosting();
-    }catch(PlatformException &e)
+    }catch(const RCSPlatformException &e)
     {
         OIC_HOSTING_LOG(DEBUG,
                 "[OICStartCoordinate] platformException, reason:%s", e.what());
         retResult = OC_STACK_ERROR;
         throw;
-    }catch(InvalidParameterException &e)
+    }catch(const RCSInvalidParameterException &e)
     {
         OIC_HOSTING_LOG(DEBUG,
                 "[OICStartCoordinate] InvalidParameterException, reason:%s", e.what());
index 0d3f82a..f8e4833 100644 (file)
@@ -117,7 +117,7 @@ Java_org_iotivity_service_client_RcsDiscoveryManager_nativeDiscoverResource(
 
         return taskObj;
     }
-    catch (const PlatformException& e) {
+    catch (const RCSPlatformException& e) {
         throwPlatformException(env, e);
     }
 
index 91e4b99..d4116e2 100644 (file)
@@ -297,7 +297,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeStartMonitoring
         res->startMonitoring(
                 std::bind(onStateChanged, std::placeholders::_1, JavaGlobalRef{ env, listener }));
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
     }
@@ -348,7 +348,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeStartCaching
             res->startCaching();
         }
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
     }
@@ -391,7 +391,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeIsCachedAvailable
     {
         return res->isCachedAvailable();
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
         return false;
@@ -414,7 +414,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeGetCachedAttribut
 
         return newAttributesObject(env, attrs);
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
         return { };
@@ -436,7 +436,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeGetRemoteAttribut
         res->getRemoteAttributes(std::bind(onRemoteAttributesReceived,
                 std::placeholders::_1, std::placeholders::_2, JavaGlobalRef{ env, listener }));
     }
-    catch (const PlatformException& e) {
+    catch (const RCSPlatformException& e) {
         throwPlatformException(env, e);
     }
 }
@@ -457,7 +457,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeSetRemoteAttribut
         res->setRemoteAttributes(attrs, std::bind(onRemoteAttributesReceived,
                 std::placeholders::_1, std::placeholders::_2, JavaGlobalRef{ env, listener }));
     }
-    catch (const PlatformException& e) {
+    catch (const RCSPlatformException& e) {
         throwPlatformException(env, e);
     }
 }
index 36a298d..f38d309 100644 (file)
@@ -417,7 +417,7 @@ Java_org_iotivity_service_server_RcsResourceObject_nativeBuild
 
         return resourceObj;
     }
-    catch (const PlatformException& e)
+    catch (const RCSPlatformException& e)
     {
         LOGE("%s", e.what());
         throwPlatformException(env, e);
@@ -460,7 +460,7 @@ Java_org_iotivity_service_server_RcsResourceObject_nativeGetAttributeValue
 
         return valueObj;
     }
-    catch(const InvalidKeyException& e)
+    catch(const RCSInvalidKeyException& e)
     {
         return nullptr;
     }
@@ -602,7 +602,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_server_RcsResourceObject_native
     {
         res->notify();
     }
-    catch (const PlatformException& e) {
+    catch (const RCSPlatformException& e) {
         throwPlatformException(env, e);
     }
 }
index 52c9f34..74e6cfc 100644 (file)
@@ -44,7 +44,7 @@ void clearJavaExceptions(JNIEnvWrapper* env)
     env->DeleteGlobalRef(g_cls_PlatformException);
 }
 
-void throwPlatformException(JNIEnv* env, const OIC::Service::PlatformException& e)
+void throwPlatformException(JNIEnv* env, const OIC::Service::RCSPlatformException& e)
 {
     auto msg = newStringObject(env, e.getReason());
     VERIFY_NO_EXC(env);
index ca2a6cc..eccbf0d 100644 (file)
@@ -29,7 +29,7 @@ namespace OIC
 {
     namespace Service
     {
-        class PlatformException;
+        class RCSPlatformException;
     }
 }
 
@@ -38,7 +38,7 @@ class JNIEnvWrapper;
 void initJavaExceptions(JNIEnvWrapper*);
 void clearJavaExceptions(JNIEnvWrapper*);
 
-void throwPlatformException(JNIEnv*, const OIC::Service::PlatformException&);
+void throwPlatformException(JNIEnv*, const OIC::Service::RCSPlatformException&);
 
 template < typename ENV >
 void throwRCSException(ENV* env, const char* msg)
index ba1383b..86a8a3d 100644 (file)
@@ -248,7 +248,7 @@ void initServer()
     {
         createResource();
     }
-    catch (const PlatformException &e)
+    catch (const RCSPlatformException &e)
     {
         std::cout << "Exception in initServer : " << e.what() << std::endl;
     }
index 197f8b0..82c8781 100644 (file)
@@ -332,7 +332,7 @@ void getCachedAttributes()
             }
         }
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         std::cout << "Exception in getCachedAttributes : " << e.what() << std::endl;
     }
@@ -346,11 +346,11 @@ void getCachedAttribute()
                   << "\tvalue : " << resource->getCachedAttribute(defaultKey).get< int >()
                   << std::endl;
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         std::cout << "Exception in getCachedAttribute : " << e.what() << std::endl;
     }
-    catch (const BadGetException& e)
+    catch (const RCSBadGetException& e)
     {
         std::cout << "Exception in getCachedAttribute : " << e.what() << std::endl;
     }
index b1c67cf..983b375 100644 (file)
@@ -160,7 +160,7 @@ void initServer()
     {
         createResource();
     }
-    catch (const PlatformException& e)
+    catch (const RCSPlatformException& e)
     {
         std::cout << "Exception in initServer : " << e.what() << std::endl;
     }
index c90943b..7c2fb62 100644 (file)
@@ -236,7 +236,7 @@ static void initServer()
         server = RCSResourceObject::Builder(resourceUri, resourceType,
                                             resourceInterface).setDiscoverable(true).setObservable(true).build();
     }
-    catch (const PlatformException &e)
+    catch (const RCSPlatformException &e)
     {
         dlog_print(DLOG_ERROR, LOG_TAG, "#### Create resource exception! (%s)", e.what());
     }
index b07fb17..0d61537 100644 (file)
@@ -195,12 +195,12 @@ static void startMonitoring(void *data, Evas_Object *obj, void *event_info)
                 logMessage = logMessage + "Started Monitoring <br>";
                 resource->startMonitoring(&onResourceStateChanged);
             }
-            catch (const BadRequestException &e)
+            catch (const RCSBadRequestException &e)
             {
                 logMessage = logMessage + "Exception BadRequest<br>";
                 dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in isMonitoring : %s", e.what());
             }
-            catch (const InvalidParameterException &e)
+            catch (const RCSInvalidParameterException &e)
             {
                 logMessage = logMessage + "Exception Invalid Param<br>";
                 dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in isMonitoring : %s", e.what());
@@ -303,7 +303,7 @@ static void startCaching(std::function <void (const RCSResourceAttributes &)>cb)
                     logMessage = logMessage + "Caching with callback <br>";
                     resource->startCaching(&onCacheUpdated);
                 }
-                catch (const BadRequestException &e)
+                catch (const RCSBadRequestException &e)
                 {
                     logMessage = logMessage + "Exception BadRequest<br>";
                     dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in startCaching : %s", e.what());
@@ -317,7 +317,7 @@ static void startCaching(std::function <void (const RCSResourceAttributes &)>cb)
                     logMessage = logMessage + "Caching without callback <br>";
                     resource->startCaching();
                 }
-                catch (const BadRequestException &e)
+                catch (const RCSBadRequestException &e)
                 {
                     logMessage = logMessage + "Exception BadRequest<br>";
                     dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in startCaching : %s", e.what());
@@ -401,7 +401,7 @@ static void getCachedAttributes(void *data, Evas_Object *obj, void *event_info)
                 }
             }
         }
-        catch (const BadRequestException &e)
+        catch (const RCSBadRequestException &e)
         {
             logMessage = "Exception Received<br>";
             dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in getCachedAttributes : %s", e.what());
@@ -430,12 +430,12 @@ static void getCachedAttribute(void *data, Evas_Object *obj, void *event_info)
             int attrValue = resource->getCachedAttribute(defaultKey).get< int >();
             logMessage = logMessage + "VALUE:" + to_string(attrValue) + "<br>";
         }
-        catch (const BadRequestException &e)
+        catch (const RCSBadRequestException &e)
         {
             logMessage = logMessage + "Exception BadRequest<br>";
             dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in getCachedAttribute : %s", e.what());
         }
-        catch (const BadGetException &e)
+        catch (const RCSBadGetException &e)
         {
             logMessage = logMessage + "Exception BadGet<br>";
             dlog_print(DLOG_INFO, LOG_TAG, "#### Exception in getCachedAttribute : %s", e.what());
index a7556f1..47aac09 100644 (file)
@@ -178,7 +178,7 @@ static void initServer()
         server = RCSResourceObject::Builder(resourceUri, resourceType,
                                             resourceInterface).setDiscoverable(true).setObservable(true).build();
     }
-    catch (const PlatformException &e)
+    catch (const RCSPlatformException &e)
     {
         dlog_print(DLOG_ERROR, LOG_TAG, "#### Create resource exception! (%s)", e.what());
     }
index 256ba59..acd45d3 100644 (file)
@@ -80,10 +80,10 @@ namespace OIC
          * Thrown when OC layer returns an error.
          *
          */
-        class PlatformException: public RCSException
+        class RCSPlatformException: public RCSException
         {
         public:
-            explicit PlatformException(OCStackResult reason);
+            explicit RCSPlatformException(OCStackResult reason);
 
             /**
              * Returns the reason.
@@ -105,43 +105,43 @@ namespace OIC
          * Thrown when a request is not acceptable.
          *
          */
-        class BadRequestException: public RCSException
+        class RCSBadRequestException: public RCSException
         {
         public:
-            explicit BadRequestException(const std::string& what);
-            explicit BadRequestException(std::string&& what);
+            explicit RCSBadRequestException(const std::string& what);
+            explicit RCSBadRequestException(std::string&& what);
         };
 
         /**
          * Thrown when a parameter is not valid.
          *
          */
-        class InvalidParameterException: public RCSException
+        class RCSInvalidParameterException: public RCSException
         {
         public:
-            explicit InvalidParameterException(const std::string& what);
-            explicit InvalidParameterException(std::string&& what);
+            explicit RCSInvalidParameterException(const std::string& what);
+            explicit RCSInvalidParameterException(std::string&& what);
         };
 
         /**
          * Thrown when getting value with wrong template parameter.
          */
-        class BadGetException: public RCSException
+        class RCSBadGetException: public RCSException
         {
         public:
-            explicit BadGetException(const std::string& what);
-            explicit BadGetException(std::string&& what);
+            explicit RCSBadGetException(const std::string& what);
+            explicit RCSBadGetException(std::string&& what);
         };
 
         /**
          * Thrown when a key is invalid.
          *
          */
-        class InvalidKeyException: public RCSException
+        class RCSInvalidKeyException: public RCSException
         {
         public:
-            explicit InvalidKeyException(const std::string& what);
-            explicit InvalidKeyException(std::string&& what);
+            explicit RCSInvalidKeyException(const std::string& what);
+            explicit RCSInvalidKeyException(std::string&& what);
         };
 
     }
index 670f77b..90afa5d 100644 (file)
@@ -351,7 +351,7 @@ namespace OIC
                     }
                     catch (const boost::bad_get&)
                     {
-                        throw BadGetException{ "Wrong type" };
+                        throw RCSBadGetException{ "Wrong type" };
                     }
                 }
 
@@ -362,7 +362,7 @@ namespace OIC
                     {
                         return get< T >() == rhs;
                     }
-                    catch (const BadGetException&)
+                    catch (const RCSBadGetException&)
                     {
                         return false;
                     }
index ac4b088..f7ca6bd 100644 (file)
@@ -64,12 +64,12 @@ namespace OIC
         {
             if (delay < 0LL)
             {
-                throw InvalidParameterException{ "delay can't be negative." };
+                throw RCSInvalidParameterException{ "delay can't be negative." };
             }
 
             if (!cb)
             {
-                throw InvalidParameterException{ "callback is empty." };
+                throw RCSInvalidParameterException{ "callback is empty." };
             }
 
             return addTask(convertToTime(Milliseconds{ delay }), std::move(cb), generateId());
index 6faaf8c..c91f9d9 100644 (file)
@@ -83,14 +83,14 @@ namespace OIC
                 if (actual == r) return;
             }
 
-            throw PlatformException(actual);
+            throw RCSPlatformException(actual);
         }
 
         inline void expectOCStackResult(OCStackResult actual, OCStackResult expected)
         {
             if (actual != expected)
             {
-                throw PlatformException(actual);
+                throw RCSPlatformException(actual);
             }
         }
 
@@ -111,7 +111,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
@@ -127,7 +127,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
@@ -142,7 +142,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
@@ -159,7 +159,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
@@ -177,7 +177,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
@@ -194,7 +194,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
@@ -212,7 +212,7 @@ namespace OIC
             }
             catch (const OC::OCException& e)
             {
-                throw PlatformException(e.code());
+                throw RCSPlatformException(e.code());
             }
         }
 
index 02e8dce..b696718 100644 (file)
@@ -51,62 +51,62 @@ namespace OIC
         }
 
 
-        PlatformException::PlatformException(OCStackResult reason) :
+        RCSPlatformException::RCSPlatformException(OCStackResult reason) :
                 RCSException{ "Failed : " + OC::OCException::reason(reason) },
                 m_reason { reason }
         {
         }
 
-        OCStackResult PlatformException::getReasonCode() const
+        OCStackResult RCSPlatformException::getReasonCode() const
         {
             return m_reason;
         }
 
-        std::string PlatformException::getReason() const
+        std::string RCSPlatformException::getReason() const
         {
             return  OC::OCException::reason(m_reason);
         }
 
 
-        BadRequestException::BadRequestException(const std::string& what) :
+        RCSBadRequestException::RCSBadRequestException(const std::string& what) :
                 RCSException{ what }
         {
         }
 
-        BadRequestException::BadRequestException(std::string&& what) :
+        RCSBadRequestException::RCSBadRequestException(std::string&& what) :
                 RCSException{ std::move(what) }
         {
         }
 
 
-        InvalidParameterException::InvalidParameterException(const std::string& what) :
+        RCSInvalidParameterException::RCSInvalidParameterException(const std::string& what) :
                 RCSException{ what }
         {
         }
 
-        InvalidParameterException::InvalidParameterException(std::string&& what) :
+        RCSInvalidParameterException::RCSInvalidParameterException(std::string&& what) :
                 RCSException{ std::move(what) }
         {
         }
 
 
-        BadGetException::BadGetException(const std::string& what) :
+        RCSBadGetException::RCSBadGetException(const std::string& what) :
                 RCSException{ what }
         {
         }
 
-        BadGetException::BadGetException(std::string&& what) :
+        RCSBadGetException::RCSBadGetException(std::string&& what) :
                 RCSException{ std::move(what) }
         {
         }
 
 
-        InvalidKeyException::InvalidKeyException(const std::string& what) :
+        RCSInvalidKeyException::RCSInvalidKeyException(const std::string& what) :
                 RCSException{ what }
         {
         }
 
-        InvalidKeyException::InvalidKeyException(std::string&& what) :
+        RCSInvalidKeyException::RCSInvalidKeyException(std::string&& what) :
                 RCSException{ std::move(what) }
         {
         }
index 1318154..cb339ec 100644 (file)
@@ -363,7 +363,7 @@ namespace OIC
                 -> result_type
         {
             // should not reach here.
-            throw BadGetException("");
+            throw RCSBadGetException("");
         }
 
         auto RCSResourceAttributes::KeyValuePair::ConstValueVisitor::operator()(
@@ -551,7 +551,7 @@ namespace OIC
             }
             catch (const std::out_of_range&)
             {
-                throw InvalidKeyException{ "No attribute named '" + key + "'" };
+                throw RCSInvalidKeyException{ "No attribute named '" + key + "'" };
             }
         }
 
@@ -563,7 +563,7 @@ namespace OIC
             }
             catch (const std::out_of_range&)
             {
-                throw InvalidKeyException{ "No attribute named '" + key + "'" };
+                throw RCSInvalidKeyException{ "No attribute named '" + key + "'" };
             }
         }
 
index 845737a..191e8ec 100644 (file)
@@ -57,7 +57,7 @@ TEST_F(PresenceSubscriberNonMemberTest, SubscribePresenceThrowsIfResultIsNotOK)
             static_cast< SubscribePresence1>(OC::OCPlatform::subscribePresence))
                     .Return(OC_STACK_ERROR);
 
-    ASSERT_THROW(subscribePresence(handle, "", CONTYPE, SubscribeCallback()), PlatformException);
+    ASSERT_THROW(subscribePresence(handle, "", CONTYPE, SubscribeCallback()), RCSPlatformException);
 }
 
 TEST_F(PresenceSubscriberNonMemberTest, OCPlatformUnsubscribePresenceWillBeCalled)
@@ -71,7 +71,7 @@ TEST_F(PresenceSubscriberNonMemberTest, UnsubscribePresenceThrowIfResultIsNotOK)
 {
     mocks.ExpectCallFuncOverload(OC::OCPlatform::unsubscribePresence).Return(OC_STACK_ERROR);
 
-    ASSERT_THROW(unsubscribePresence(handle), PlatformException);
+    ASSERT_THROW(unsubscribePresence(handle), RCSPlatformException);
 }
 
 class PresenceSubscriberTest: public TestWithMock
@@ -126,7 +126,7 @@ TEST_F(PresenceSubscriberTest, ConstructorThrowsIfResultIsNotOK)
             static_cast< SubscribePresence1 >(OC::OCPlatform::subscribePresence))
                     .Return(OC_STACK_ERROR);
 
-    ASSERT_THROW(PresenceSubscriber(HOST, CONTYPE, SubscribeCallback()), PlatformException);
+    ASSERT_THROW(PresenceSubscriber(HOST, CONTYPE, SubscribeCallback()), RCSPlatformException);
 }
 
 TEST_F(PresenceSubscriberTest, IsSubscribingIfConstructedWithoutException)
index 8f15ad5..6355fa5 100644 (file)
@@ -82,7 +82,7 @@ TEST_F(PrimitiveResourceTest, RequestGetThrowsOCResourceGetReturnsNotOK)
 {
     mocks.OnCall(fakeResource, FakeOCResource::get).Return(OC_STACK_ERROR);
 
-    ASSERT_THROW(resource->requestGet(PrimitiveResource::GetCallback()), PlatformException);
+    ASSERT_THROW(resource->requestGet(PrimitiveResource::GetCallback()), RCSPlatformException);
 }
 
 TEST_F(PrimitiveResourceTest, RequestSetInvokesOCResourcePut)
@@ -97,7 +97,7 @@ TEST_F(PrimitiveResourceTest, RequestSetThrowsOCResourcePutReturnsNotOK)
     mocks.OnCall(fakeResource, FakeOCResource::put).Return(OC_STACK_ERROR);
 
     ASSERT_THROW(resource->requestSet(RCSResourceAttributes{ }, PrimitiveResource::SetCallback()),
-            PlatformException);
+            RCSPlatformException);
 }
 
 TEST_F(PrimitiveResourceTest, RequestSetPassResourceAttributesToOCResourcePut)
@@ -129,7 +129,7 @@ TEST_F(PrimitiveResourceTest, RequestObserveThrowsOCResourceObserveReturnsNotOK)
 {
     mocks.OnCall(fakeResource, FakeOCResource::observe).Return(OC_STACK_ERROR);
 
-    ASSERT_THROW(resource->requestObserve(PrimitiveResource::ObserveCallback()), PlatformException);
+    ASSERT_THROW(resource->requestObserve(PrimitiveResource::ObserveCallback()), RCSPlatformException);
 }
 
 TEST_F(PrimitiveResourceTest, DelegteGettersToOCResource)
@@ -204,6 +204,6 @@ TEST_F(DiscoverResourceTest, ThrowsdWhenOCPlatformFindResourceReturnsNotOK)
     mocks.ExpectCallFuncOverload(static_cast<FindResource>(OC::OCPlatform::findResource)).
             Return(OC_STACK_ERROR);
 
-    EXPECT_THROW(discoverResource("", "", OCConnectivityType{ }, discovered), PlatformException);
+    EXPECT_THROW(discoverResource("", "", OCConnectivityType{ }, discovered), RCSPlatformException);
 }
 
index 264ebf2..acb8732 100644 (file)
@@ -53,12 +53,12 @@ TEST_F(ResourceAttributesTest, ValueThrowsIfTypeDoesNotMatch)
      resourceAttributes[KEY] = 1;
     auto& valueRef = resourceAttributes[KEY];
 
-    ASSERT_THROW(valueRef.get< std::string >(), BadGetException);
+    ASSERT_THROW(valueRef.get< std::string >(), RCSBadGetException);
 }
 
 TEST_F(ResourceAttributesTest, GettingWithAtThrowsIfThereIsNoMatchedValue)
 {
-    ASSERT_THROW(resourceAttributes.at(KEY), InvalidKeyException);
+    ASSERT_THROW(resourceAttributes.at(KEY), RCSInvalidKeyException);
 }
 
 TEST_F(ResourceAttributesTest, CopyingValueDoesNotShareState)
@@ -103,7 +103,7 @@ TEST_F(ResourceAttributesTest, GettingWithAtThrowsAfterRemoved)
 
     resourceAttributes.erase(KEY);
 
-    ASSERT_THROW(resourceAttributes.at(KEY), InvalidKeyException);
+    ASSERT_THROW(resourceAttributes.at(KEY), RCSInvalidKeyException);
 }
 
 TEST_F(ResourceAttributesTest, NoDataErasedIfKeyDoesNotMatch)
index 56e2545..fee3837 100644 (file)
@@ -44,11 +44,11 @@ namespace OIC
                 InvalidParameterException(std::string&& what)
                 : RCSException{ std::move(what) } {}
             };
-            class FailedSubscribePresenceException: public PlatformException
+            class FailedSubscribePresenceException: public RCSPlatformException
             {
             public:
                 FailedSubscribePresenceException(OCStackResult reason)
-                : PlatformException{reason} {}
+                : RCSPlatformException{reason} {}
             };
 
             static ResourceBroker * getInstance();
index aade9e9..b3ada66 100644 (file)
@@ -60,7 +60,7 @@ namespace OIC
                 OC_LOG_V(DEBUG, BROKER_TAG, "subscribe Presence");
                 presenceSubscriber
                 = PresenceSubscriber(address, BROKER_TRANSPORT, pSubscribeRequestCB);
-            } catch(PlatformException &e)
+            } catch(RCSPlatformException &e)
             {
                 OC_LOG_V(DEBUG, BROKER_TAG,
                         "exception in subscribe Presence %s", e.getReason().c_str());
index 0332bcd..fe1c852 100644 (file)
@@ -84,7 +84,7 @@ namespace OIC
                     OC_LOG_V(DEBUG, BROKER_TAG, "create the ResourcePresence.");
                     presenceItem.reset(new ResourcePresence());
                     presenceItem->initializeResourcePresence(pResource);
-                }catch(PlatformException &e)
+                }catch(RCSPlatformException &e)
                 {
                     throw FailedSubscribePresenceException(e.getReasonCode());
                 }
index 6d4b3de..e773f15 100644 (file)
@@ -110,7 +110,7 @@ TEST_F(DevicePresenceTest,initializeDevicePresence_ErrorHandlingIfAbnormalResour
     MockingFunc();
     mocks.OnCallFuncOverload(static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Return(OC_STACK_ERROR);
 
-    ASSERT_THROW(instance->initializeDevicePresence(pResource),PlatformException);
+    ASSERT_THROW(instance->initializeDevicePresence(pResource),RCSPlatformException);
 
 }
 
index 660a126..0305d3e 100755 (executable)
@@ -81,7 +81,7 @@ namespace OIC
         {
             if (!cb)
             {
-                throw InvalidParameterException { "input Parameter(callback) is NULL" };
+                throw RCSInvalidParameterException { "input Parameter(callback) is NULL" };
             }
 
             DiscoverRequestInfo discoveryItem;
index 0d5af4d..388ac21 100644 (file)
@@ -157,13 +157,13 @@ namespace OIC
 
             if (!cb)
             {
-                throw InvalidParameterException{ "startMonitoring : Callback is NULL" };
+                throw RCSInvalidParameterException{ "startMonitoring : Callback is NULL" };
             }
 
             if (isMonitoring())
             {
                 OC_LOG(DEBUG, TAG, "startMonitoring : already started");
-                throw BadRequestException{ "Monitoring already started." };
+                throw RCSBadRequestException{ "Monitoring already started." };
             }
 
             m_brokerId = ResourceBroker::getInstance()->hostResource(m_primitiveResource,
@@ -209,7 +209,7 @@ namespace OIC
             if (isCaching())
             {
                 OC_LOG(DEBUG, TAG, "startCaching : already Started");
-                throw BadRequestException{ "Caching already started." };
+                throw RCSBadRequestException{ "Caching already started." };
             }
 
             if (cb)
@@ -271,12 +271,12 @@ namespace OIC
 
             if (!isCaching())
             {
-                throw BadRequestException{ "Caching not started." };
+                throw RCSBadRequestException{ "Caching not started." };
             }
 
             if (!isCachedAvailable())
             {
-                throw BadRequestException{ "Cache data is not available." };
+                throw RCSBadRequestException{ "Cache data is not available." };
             }
 
             return ResourceCacheManager::getInstance()->getCachedData(m_primitiveResource);
@@ -316,7 +316,7 @@ namespace OIC
 
             if (!cb)
             {
-                throw InvalidParameterException{ "getRemoteAttributes : Callback is empty" };
+                throw RCSInvalidParameterException{ "getRemoteAttributes : Callback is empty" };
             }
 
             m_primitiveResource->requestGet(
@@ -331,7 +331,7 @@ namespace OIC
 
             if (!cb)
             {
-                throw InvalidParameterException{ "setRemoteAttributes : Callback is empty" };
+                throw RCSInvalidParameterException{ "setRemoteAttributes : Callback is empty" };
             }
 
             m_primitiveResource->requestSet(attribute,
index e34ff3b..a95f408 100644 (file)
@@ -71,7 +71,7 @@ void DiscoverResourceUnit::startDiscover(DiscoverResourceInfo info, UpdatedCB up
         discoveryTask = RCSDiscoveryManager::getInstance()->discoverResourceByType(
                 RCSAddress::multicast(), m_ResourceType, pDiscoveredCB);
     }
-    catch (InvalidParameterException &e)
+    catch (RCSInvalidParameterException &e)
     {
         // TODO Handle Exception
         return;
@@ -112,7 +112,7 @@ void DiscoverResourceUnit::onUpdate(REMOTE_MSG msg, RCSRemoteResourceObject::Ptr
         {
             updatedResource->getCachedAttribute(m_AttrubuteName);
         }
-        catch (InvalidKeyException &e)
+        catch (RCSInvalidKeyException &e)
         {
             // TODO Handle Exception
             return;
@@ -154,7 +154,7 @@ std::vector<RCSResourceAttributes::Value> DiscoverResourceUnit::buildInputResour
             retVector.push_back(value);
 
         }
-        catch (InvalidKeyException &e)
+        catch (RCSInvalidKeyException &e)
         {
             // TODO Handle Exception
         }
index 05b9268..261caf2 100644 (file)
@@ -510,7 +510,7 @@ namespace OIC
             {
                 autoNotify(!replaced.empty(), m_autoNotifyPolicy);
                 return sendResponse(*this, request, response);
-            } catch (const PlatformException& e) {
+            } catch (const RCSPlatformException& e) {
                 OC_LOG_V(ERROR, LOG_TAG, "Error : %s ", e.what());
                 return OC_EH_ERROR;
             }
index 3e15bbc..223067d 100644 (file)
@@ -42,7 +42,7 @@ constexpr int value{ 100 };
 
 TEST(ResourceObjectBuilderCreateTest, ThrowIfUriIsInvalid)
 {
-    ASSERT_THROW(RCSResourceObject::Builder("", "", "").build(), PlatformException);
+    ASSERT_THROW(RCSResourceObject::Builder("", "", "").build(), RCSPlatformException);
 }
 
 class ResourceObjectBuilderTest: public TestWithMock
index 64edc87..9f62ea6 100644 (file)
@@ -146,7 +146,7 @@ private:
 
 TEST_F(RemoteResourceObjectTest, GetRemoteAttributesDoesNotAllowEmptyFunction)
 {
-    ASSERT_THROW(object->getRemoteAttributes({ }), InvalidParameterException);
+    ASSERT_THROW(object->getRemoteAttributes({ }), RCSInvalidParameterException);
 }
 
 TEST_F(RemoteResourceObjectTest, GetRemoteAttributesGetsAttributesOfServer)
@@ -166,7 +166,7 @@ TEST_F(RemoteResourceObjectTest, GetRemoteAttributesGetsAttributesOfServer)
 
 TEST_F(RemoteResourceObjectTest, SetRemoteAttributesDoesNotAllowEmptyFunction)
 {
-    ASSERT_THROW(object->setRemoteAttributes({ }, { }), InvalidParameterException);
+    ASSERT_THROW(object->setRemoteAttributes({ }, { }), RCSInvalidParameterException);
 }
 
 TEST_F(RemoteResourceObjectTest, SetRemoteAttributesSetsAttributesOfServer)
@@ -191,7 +191,7 @@ TEST_F(RemoteResourceObjectTest, MonitoringIsNotStartedByDefault)
 
 TEST_F(RemoteResourceObjectTest, StartMonitoringThrowsIfFunctionIsEmpty)
 {
-    ASSERT_THROW(object->startMonitoring({ }), InvalidParameterException);
+    ASSERT_THROW(object->startMonitoring({ }), RCSInvalidParameterException);
 }
 
 TEST_F(RemoteResourceObjectTest, IsMonitoringReturnsTrueAfterStartMonitoring)
@@ -205,7 +205,7 @@ TEST_F(RemoteResourceObjectTest, StartMonitoringThrowsIfTryingToStartAgain)
 {
     object->startMonitoring(resourceStateChanged);
 
-    ASSERT_THROW(object->startMonitoring(resourceStateChanged), BadRequestException);
+    ASSERT_THROW(object->startMonitoring(resourceStateChanged), RCSBadRequestException);
 }
 
 TEST_F(RemoteResourceObjectTest, DefaultStateIsNone)
@@ -229,7 +229,7 @@ TEST_F(RemoteResourceObjectTest, StartCachingThrowsIfTryingToStartAgain)
 {
     object->startCaching(cacheUpdatedCallback);
 
-    ASSERT_THROW(object->startCaching(), BadRequestException);
+    ASSERT_THROW(object->startCaching(), RCSBadRequestException);
 }
 
 TEST_F(RemoteResourceObjectTest, DefaultCacheStateIsNone)
@@ -303,7 +303,7 @@ TEST_F(RemoteResourceObjectTest, DISABLED_CacheUpdatedCallbackBeCalledWithUpdate
 
 TEST_F(RemoteResourceObjectTest, GetCachedAttributesThrowsIfCachingIsNotStarted)
 {
-    ASSERT_THROW(object->getCachedAttributes(), BadRequestException);
+    ASSERT_THROW(object->getCachedAttributes(), RCSBadRequestException);
 }
 
 TEST_F(RemoteResourceObjectTest, CachedAttributesHasSameAttributesWithServer)
@@ -320,7 +320,7 @@ TEST_F(RemoteResourceObjectTest, CachedAttributesHasSameAttributesWithServer)
 
 TEST_F(RemoteResourceObjectTest, GetCachedAttributeThrowsIfCachingIsNotStarted)
 {
-    ASSERT_THROW(object->getCachedAttribute(ATTR_KEY), BadRequestException);
+    ASSERT_THROW(object->getCachedAttribute(ATTR_KEY), RCSBadRequestException);
 }
 
 TEST_F(RemoteResourceObjectTest, GetCachedAttributeThrowsIfKeyIsInvalid)
@@ -330,7 +330,7 @@ TEST_F(RemoteResourceObjectTest, GetCachedAttributeThrowsIfKeyIsInvalid)
     object->startCaching(cacheUpdatedCallback);
     Wait();
 
-    ASSERT_THROW(object->getCachedAttribute(""), InvalidKeyException);
+    ASSERT_THROW(object->getCachedAttribute(""), RCSInvalidKeyException);
 }
 
 TEST_F(RemoteResourceObjectTest, HasSameUriWithServer)