pavlukhin commented on a change in pull request #7320: IGNITE-12468 Java thin
client: deserialization of arrays, collections and maps fixed
URL: https://github.com/apache/ignite/pull/7320#discussion_r375798724
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java
##########
@@ -522,12 +528,73 @@ void writeObject(BinaryOutputStream out, Object obj) {
/** Read Ignite binary object from input stream. */
<T> T readObject(BinaryInputStream in, boolean keepBinary) {
- Object val = marsh.unmarshal(in);
+ if (keepBinary)
+ return (T)marsh.unmarshal(in);
+ else {
+ BinaryReaderHandles hnds = new BinaryReaderHandles();
+
+ return (T)unwrapBinary(marsh.deserialize(in, hnds), hnds);
+ }
+ }
+
+ /**
+ * Unwrap binary object.
+ */
+ private Object unwrapBinary(Object obj, BinaryReaderHandles hnds) {
+ if (obj instanceof BinaryObjectImpl) {
+ BinaryObjectImpl obj0 = (BinaryObjectImpl)obj;
+
+ return
marsh.deserialize(BinaryHeapInputStream.create(obj0.array(), obj0.start()),
hnds);
+ }
+ else if (obj instanceof BinaryObject )
Review comment:
Cosmetic. Extra space between `BinaryObject` and `)`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services