This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 5933abc  GEODE-4632: Replace CacheableString with std::string. (#215)
5933abc is described below

commit 5933abccf2b34fd73369af9ece498f2fdaf34ad4
Author: Jacob Barrett <jbarr...@pivotal.io>
AuthorDate: Thu Feb 8 07:36:07 2018 -0800

    GEODE-4632: Replace CacheableString with std::string. (#215)
---
 .../geode/UserFunctionExecutionException.hpp       | 78 +++++-----------------
 .../integration-test/testThinClientPdxTests.cpp    |  6 +-
 .../testThinClientPoolExecuteFunction.cpp          |  5 +-
 .../testThinClientPoolExecuteFunctionPrSHOP.cpp    |  5 +-
 ...hinClientPoolExecuteFunctionThrowsException.cpp |  2 +-
 .../testThinClientSecurityAuthorizationMU.cpp      |  4 +-
 cppcache/src/ThinClientRegion.cpp                  |  4 +-
 cppcache/src/UserFunctionExecutionException.cpp    |  3 -
 8 files changed, 30 insertions(+), 77 deletions(-)

diff --git a/cppcache/include/geode/UserFunctionExecutionException.hpp 
b/cppcache/include/geode/UserFunctionExecutionException.hpp
index 91671eb..94e9d70 100644
--- a/cppcache/include/geode/UserFunctionExecutionException.hpp
+++ b/cppcache/include/geode/UserFunctionExecutionException.hpp
@@ -20,9 +20,8 @@
 #ifndef GEODE_USERFUNCTIONEXECUTIONEXCEPTION_H_
 #define GEODE_USERFUNCTIONEXECUTIONEXCEPTION_H_
 
-
-
 #include <memory>
+#include <string>
 
 #include "CacheableString.hpp"
 #include "Serializable.hpp"
@@ -32,93 +31,52 @@ namespace geode {
 namespace client {
 
 class UserFunctionExecutionException;
-class CacheableString;
 class DataInput;
 class DataOutput;
 
 /**
  * @brief UserFunctionExecutionException class is used to encapsulate geode
- *sendException in case of Function execution.
- **/
+ * sendException in case of Function execution.
+ */
 class UserFunctionExecutionException : public Serializable {
  public:
-  /**
-   * @brief constructors
-   */
-  explicit UserFunctionExecutionException(std::shared_ptr<CacheableString> 
msg);
+  explicit UserFunctionExecutionException(std::string message)
+      : m_message(std::move(message)) {}
   UserFunctionExecutionException(const UserFunctionExecutionException& other) =
       delete;
   void operator=(const UserFunctionExecutionException& other) = delete;
 
-  /**
-   * @brief destructor
-   */
-  virtual ~UserFunctionExecutionException() = default;
+  ~UserFunctionExecutionException() override = default;
 
-  /**
-   *@brief serialize this object
-   * @throws IllegalStateException If this api is called from User code.
-   **/
   void toData(DataOutput& output) const override;
 
-  /**
-   *@brief deserialize this object, typical implementation should return
-   * the 'this' pointer.
-   * @throws IllegalStateException If this api is called from User code.
-   **/
   virtual void fromData(DataInput& input) override;
 
-  /**
-   *@brief Return the classId of the instance being serialized.
-   * This is used by deserialization to determine what instance
-   * type to create and deserialize into.
-   *
-   * The classId must be unique within an application suite.
-   * Using a negative value may result in undefined behavior.
-   * @throws IllegalStateException If this api is called from User code.
-   */
   virtual int32_t classId() const override;
 
-  /**
-   *@brief return the size in bytes of the instance being serialized.
-   * This is used to determine whether the cache is using up more
-   * physical memory than it has been configured to use. The method can
-   * return zero if the user does not require the ability to control
-   * cache memory utilization.
-   * Note that you must implement this only if you use the HeapLRU feature.
-   * @throws IllegalStateException If this api is called from User code.
-   */
   virtual size_t objectSize() const override;
 
-  /**
-   *@brief return the typeId byte of the instance being serialized.
-   * This is used by deserialization to determine what instance
-   * type to create and deserialize into.
-   *
-   * Note that this should not be overridden by custom implementations
-   * and is reserved only for builtin types.
-   */
   virtual int8_t typeId() const override;
 
   /**
-   *@brief return as std::shared_ptr<CacheableString> the Exception message
-   *returned from geode sendException api.
-   **/
-  std::shared_ptr<CacheableString> getMessage() { return m_message; }
+   * @brief return as std::string the Exception message returned from geode
+   * sendException api.
+   */
+  const std::string& getMessage() const { return m_message; }
+
+  std::string toString() const override { return this->getMessage(); }
 
   /**
-   *@brief return as std::shared_ptr<CacheableString> the Exception name
-   *returned from geode sendException api.
-   **/
-  std::shared_ptr<CacheableString> getName() {
-    static const auto name =
-        CacheableString::create("UserFunctionExecutionException");
+   * @brief return as std::string the Exception name returned from geode
+   * sendException api.
+   */
+  const std::string& getName() const {
+    static const std::string name = "UserFunctionExecutionException";
     return name;
   }
 
  private:
-
-  std::shared_ptr<CacheableString> m_message;  // error message
+  std::string m_message;
 };
 
 }  // namespace client
diff --git a/cppcache/integration-test/testThinClientPdxTests.cpp 
b/cppcache/integration-test/testThinClientPdxTests.cpp
index a00f28e..f8b0913 100644
--- a/cppcache/integration-test/testThinClientPdxTests.cpp
+++ b/cppcache/integration-test/testThinClientPdxTests.cpp
@@ -2461,7 +2461,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, generateJavaPdxType)
           ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
           LOGINFO("Done casting to uFEPtr");
           LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->value().c_str());
+                  uFEPtr->getMessage().c_str());
         } catch (...) {
           FAIL(
               "exFuncNameSendException casting to string for bool arguement "
@@ -2631,7 +2631,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyDotNetPdxTypes)
           ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
           LOGINFO("Done casting to uFEPtr");
           LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->value().c_str());
+                  uFEPtr->getMessage().c_str());
         } catch (...) {
           FAIL(
               "exFuncNameSendException casting to string for bool arguement "
@@ -2743,7 +2743,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, client3GetsV2Object)
           ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
           LOGINFO("Done casting to uFEPtr");
           LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->value().c_str());
+                  uFEPtr->getMessage().c_str());
         } catch (...) {
           FAIL(
               "exFuncNameSendException casting to string for bool arguement "
diff --git a/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp 
b/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
index b48f29e..539c048 100644
--- a/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
+++ b/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
@@ -175,7 +175,7 @@ bool 
validateResultTypeAndAllowUserFunctionExecutionException(
             std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) 
{
       LOGINFO("Done casting to uFEPtr");
       LOGINFO("Read expected uFEPtr exception %s ",
-              uFEPtr->getMessage()->value().c_str());
+              uFEPtr->getMessage().c_str());
       return true;
     } else {
       LOGINFO("Unexpected result type %s for index %d.",
@@ -191,8 +191,7 @@ bool validateResultTypeIsUserFunctionExecutionException(
   if (auto uFEPtr =
           std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
     LOGINFO("Done casting to uFEPtr");
-    LOGINFO("Read expected uFEPtr exception %s ",
-            uFEPtr->getMessage()->value().c_str());
+    LOGINFO("Read expected uFEPtr exception %s ", 
uFEPtr->getMessage().c_str());
     return true;
   } else {
     LOGINFO("Unexpected result type %s for index %d.",
diff --git 
a/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp 
b/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
index b6ddca9..f7236ec 100644
--- a/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
+++ b/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
@@ -178,7 +178,7 @@ bool 
validateResultTypeAndAllowUserFunctionExecutionException(
             std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) 
{
       LOGINFO("Done casting to uFEPtr");
       LOGINFO("Read expected uFEPtr exception %s ",
-              uFEPtr->getMessage()->value().c_str());
+              uFEPtr->getMessage().c_str());
       return true;
     } else {
       LOGINFO("Unexpected result type %s for index %d.",
@@ -194,8 +194,7 @@ bool validateResultTypeIsUserFunctionExecutionException(
   if (auto uFEPtr =
           std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
     LOGINFO("Done casting to uFEPtr");
-    LOGINFO("Read expected uFEPtr exception %s ",
-            uFEPtr->getMessage()->value().c_str());
+    LOGINFO("Read expected uFEPtr exception %s ", 
uFEPtr->getMessage().c_str());
     return true;
   } else {
     LOGINFO("Unexpected result type %s for index %d.",
diff --git 
a/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
 
b/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
index 6184944..3ac044c 100644
--- 
a/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
+++ 
b/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
@@ -265,7 +265,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
                     result->operator[](i))) {
           LOGINFO("Done casting to uFEPtr");
           LOGINFO("Read expected uFEPtr exception %s ",
-                  uFEPtr->getMessage()->value().c_str());
+                  uFEPtr->getMessage().c_str());
         } else {
           FAIL(
               "exFuncNameSendException casting to string for bool argument "
diff --git 
a/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp 
b/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
index 3aed453..7205f41 100644
--- a/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
+++ b/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
@@ -391,7 +391,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
               ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
               LOGINFO("Done casting to uFEPtr");
               LOGINFO("Read expected uFEPtr exception %s ",
-                      uFEPtr->getMessage()->value().c_str());
+                      uFEPtr->getMessage().c_str());
             }
           } catch (ClassCastException& ex) {
             std::string logmsg = "";
@@ -443,7 +443,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
             ASSERT(uFEPtr != nullptr, "uFEPtr exception is nullptr");
             LOGINFO("Done casting to uFEPtr");
             LOGINFO("Read expected uFEPtr exception %s ",
-                    uFEPtr->getMessage()->value().c_str());
+                    uFEPtr->getMessage().c_str());
           } catch (...) {
             FAIL(
                 "exFuncNameSendException casting to string for bool arguement "
diff --git a/cppcache/src/ThinClientRegion.cpp 
b/cppcache/src/ThinClientRegion.cpp
index b17a54b..2b78d7d 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -3701,9 +3701,9 @@ void ChunkedFunctionExecutionResponse::handleChunk(
     std::shared_ptr<Cacheable> result = nullptr;
     if (isExceptionPart) {
       result = std::make_shared<UserFunctionExecutionException>(
-          CacheableString::create(value->toString().c_str()));
+          std::dynamic_pointer_cast<CacheableString>(value)->value());
     } else {
-      result = std::dynamic_pointer_cast<Cacheable>(value);
+      result = value;
     }
     if (m_resultCollectorLock.get() != 0) {
       ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*m_resultCollectorLock);
diff --git a/cppcache/src/UserFunctionExecutionException.cpp 
b/cppcache/src/UserFunctionExecutionException.cpp
index 290c991..0d2c892 100644
--- a/cppcache/src/UserFunctionExecutionException.cpp
+++ b/cppcache/src/UserFunctionExecutionException.cpp
@@ -48,9 +48,6 @@ int8_t UserFunctionExecutionException::typeId() const {
   return static_cast<int8_t>(0);
 }
 
-UserFunctionExecutionException::UserFunctionExecutionException(
-    std::shared_ptr<CacheableString> msg)
-    : m_message(msg) {}
 }  // namespace client
 }  // namespace geode
 }  // namespace apache

-- 
To stop receiving notification emails like this one, please contact
jbarr...@apache.org.

Reply via email to