[
https://issues.apache.org/jira/browse/GEODE-10276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17534349#comment-17534349
]
ASF GitHub Bot commented on GEODE-10276:
----------------------------------------
pivotal-jbarrett commented on code in PR #969:
URL: https://github.com/apache/geode-native/pull/969#discussion_r869292240
##########
cppcache/src/CacheableObjectArray.cpp:
##########
@@ -53,6 +54,18 @@ size_t CacheableObjectArray::objectSize() const {
}
return size;
}
+
+std::string CacheableObjectArray::getClassName() const {
+ if (!empty()) {
+ auto&& item = *begin();
+
+ if (auto pdx = dynamic_cast<PdxSerializable*>(item.get())) {
+ return pdx->getClassName();
+ }
+ }
+
+ return "java.lang.Object";
Review Comment:
What if we make this string a `const` value in this compilation unit and
change the return type of this method to return `const std::string&` so we
aren't copy constructing strings on return.
> Refactor PDX (de)serialziation code to align it with Java client
> ----------------------------------------------------------------
>
> Key: GEODE-10276
> URL: https://issues.apache.org/jira/browse/GEODE-10276
> Project: Geode
> Issue Type: Improvement
> Components: native client
> Reporter: Mario Salazar de Torres
> Assignee: Mario Salazar de Torres
> Priority: Major
> Labels: pull-request-available
>
> Currently there are the following open issues regarding PDX (de)serialization:
> * [GEODE-9968 - Fix deserialization for new fields in PdxSerializable
> class|https://issues.apache.org/jira/browse/GEODE-9968]
> * [GEODE-9753 - Coredump during PdxSerializable object
> serialization|https://issues.apache.org/jira/browse/GEODE-9753]
> * [GEODE-10220 - Coredump while initializing PdxType
> remoteToLocal|https://issues.apache.org/jira/browse/GEODE-10220]
> * [GEODE-10255 - PdxSerializable not working correctly for multiple versions
> of the same class|https://issues.apache.org/jira/browse/GEODE-10255]
> Also, the implementation on this ticket ([GEODE-8212: Reduce connections to
> server to get type id|https://issues.apache.org/jira/browse/GEODE-8212])
> poses some issues with PDX entries which fields are a permutation. Thing is
> that PdxTypes which fields are a permutation might use the wrong offsets,
> leading to a corrupt serialization. This is something that was not taken into
> account at the time of getting this PR merged.
> So this ticket should be reverted and possibly an alternative solution
> proposed.
> In order to tackle these issues, a code refactoring is needed to introduce
> the following implementations:
> * Single type of PdxWriter
> * An implementation PdxReader that tracks unread data, and other that don't.
> * An implementation for PdxInstances that guarantees that fields are
> actually written in alphabetical order, independently of the writeFields call
> order. This should tackle the issue described above regarding GEODE-8212.
> * Also, it'd be ideal to make it so PDX code is cleaner and easier to
> understand, though that's a complex matter, and also, subjective.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)