tillrohrmann closed pull request #6498: [FLINK-10065] InstantiationUtil.deserializeObject(InputStream in, ClassLoader cl, boolean isFailureTolerant) will close the inputStream URL: https://github.com/apache/flink/pull/6498
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java b/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java index 2370c7c5437..802bbace060 100644 --- a/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java +++ b/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java @@ -495,9 +495,10 @@ public static void writeObjectToConfig(Object o, Configuration config, String ke final ClassLoader old = Thread.currentThread().getContextClassLoader(); // not using resource try to avoid AutoClosable's close() on the given stream - try (ObjectInputStream oois = isFailureTolerant + try { + ObjectInputStream oois = isFailureTolerant ? new InstantiationUtil.FailureTolerantObjectInputStream(in, cl) - : new InstantiationUtil.ClassLoaderObjectInputStream(in, cl)) { + : new InstantiationUtil.ClassLoaderObjectInputStream(in, cl); Thread.currentThread().setContextClassLoader(cl); return (T) oois.readObject(); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services