ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [4/4] ignite git commit: IGNITE-1917: Fixed NPE in metadata generation.
Date Mon, 16 Nov 2015 10:05:53 GMT
IGNITE-1917: Fixed NPE in metadata generation.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1c71f225
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1c71f225
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1c71f225

Branch: refs/heads/ignite-1917
Commit: 1c71f225761359e6fecd42d274543dadf554d6d3
Parents: 0b5fb1c
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Nov 16 13:04:56 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Nov 16 13:04:56 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/portable/BinaryWriterExImpl.java  | 14 ++++++++------
 .../ignite/internal/portable/PortableContext.java     |  7 ++++---
 2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1c71f225/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index 277bdb9..fa258d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -125,13 +125,15 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
      * @param ctx Context.
      */
     public BinaryWriterExImpl(PortableContext ctx) {
-        BinaryThreadLocalContext tlsCtx = BinaryThreadLocalContext.get();
-
-        this.ctx = ctx;
-        this.out = new PortableHeapOutputStream(INIT_CAP, tlsCtx.chunk());
-        this.schema = tlsCtx.schemaHolder();
+        this(ctx, BinaryThreadLocalContext.get());
+    }
 
-        start = out.position();
+    /**
+     * @param ctx Context.
+     * @param tlsCtx TLS context.
+     */
+    public BinaryWriterExImpl(PortableContext ctx, BinaryThreadLocalContext tlsCtx) {
+        this(ctx, new PortableHeapOutputStream(INIT_CAP, tlsCtx.chunk()), tlsCtx.schemaHolder(),
null);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/1c71f225/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 193e368..e3caba4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -574,8 +574,9 @@ public class PortableContext implements Externalizable {
 
         mappers.putIfAbsent(typeId, idMapper);
 
-        metaHnd.addMeta(typeId, new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), null,
-            Collections.singleton(desc.schema())).wrap(this));
+        Collection<PortableSchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema())
: null;
+
+        metaHnd.addMeta(typeId, new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), null,
schemas).wrap(this));
 
         return desc;
     }
@@ -783,7 +784,7 @@ public class PortableContext implements Externalizable {
             );
 
             fieldsMeta = desc.fieldsMeta();
-            schemas = Collections.singleton(desc.schema());
+            schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
 
             if (IgniteUtils.detectClassLoader(cls).equals(dfltLdr))
                 userTypes.put(id, desc);


Mime
View raw message