You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2019/08/08 08:00:50 UTC

[flink] 01/03: [FLINK-13159] Fix the NPE when PojoSerializer restored

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

tzulitai pushed a commit to branch release-1.9
in repository https://gitbox.apache.org/repos/asf/flink.git

commit c26ddf831520a5b6034ccf57169eb70eb4f7c47f
Author: Yun Tang <my...@live.com>
AuthorDate: Wed Aug 7 02:07:33 2019 +0800

    [FLINK-13159] Fix the NPE when PojoSerializer restored
---
 .../org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java
index dcc0a72..5c43d1e 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java
@@ -123,7 +123,7 @@ public final class PojoSerializer<T> extends TypeSerializer<T> {
 			this.fields[i].setAccessible(true);
 		}
 
-		cl = Thread.currentThread().getContextClassLoader();
+		this.cl = Thread.currentThread().getContextClassLoader();
 
 		// We only want those classes that are not our own class and are actually sub-classes.
 		LinkedHashSet<Class<?>> registeredSubclasses =
@@ -156,6 +156,7 @@ public final class PojoSerializer<T> extends TypeSerializer<T> {
 		this.registeredSerializers = checkNotNull(registeredSerializers);
 		this.subclassSerializerCache = checkNotNull(subclassSerializerCache);
 		this.executionConfig = checkNotNull(executionConfig);
+		this.cl = Thread.currentThread().getContextClassLoader();
 	}
 	
 	@Override