You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/11/25 12:31:15 UTC
[3/6] ignite git commit: IGNITE-1983 Platforms: fixed a problem with
incorrect reader behavior for platform streams.
IGNITE-1983 Platforms: fixed a problem with incorrect reader behavior for platform streams.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c40ab677
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c40ab677
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c40ab677
Branch: refs/heads/ignite-1990
Commit: c40ab677e69f0d756281c62549cb2f63de907ed6
Parents: dafad52
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Nov 25 10:14:26 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Nov 25 10:14:26 2015 +0300
----------------------------------------------------------------------
.../internal/portable/BinaryReaderExImpl.java | 18 +++++++++++++++---
.../processors/platform/PlatformContextImpl.java | 2 +-
2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c40ab677/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 4809c3c..872d7a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -162,6 +162,20 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
*/
public BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, ClassLoader ldr,
@Nullable BinaryReaderHandles hnds) {
+ this(ctx, in, ldr, hnds, false);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Context.
+ * @param in Input stream.
+ * @param ldr Class loader.
+ * @param hnds Context.
+ * @param skipHdrCheck Whether to skip header check.
+ */
+ public BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, ClassLoader ldr,
+ @Nullable BinaryReaderHandles hnds, boolean skipHdrCheck) {
// Initialize base members.
this.ctx = ctx;
this.in = in;
@@ -170,10 +184,8 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
start = in.position();
- byte hdr = in.readByte();
-
// Perform full header parsing in case of portable object.
- if (hdr == GridPortableMarshaller.OBJ) {
+ if (!skipHdrCheck && (in.readByte() == GridPortableMarshaller.OBJ)) {
// Ensure protocol is fine.
PortableUtils.checkProtocolVersion(in.readByte());
http://git-wip-us.apache.org/repos/asf/ignite/blob/c40ab677/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 9a7f0df..7db752a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -177,7 +177,7 @@ public class PlatformContextImpl implements PlatformContext {
/** {@inheritDoc} */
@Override public BinaryRawReaderEx reader(PlatformInputStream in) {
// TODO: IGNITE-1272 - Is class loader needed here?
- return new BinaryReaderExImpl(marsh.context(), in, null);
+ return new BinaryReaderExImpl(marsh.context(), in, null, null, true);
}
/** {@inheritDoc} */