From issues-return-191541-archive-asf-public=cust-asf.ponee.io@flink.apache.org Fri Sep 28 18:41:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 989C5180627 for ; Fri, 28 Sep 2018 18:41:04 +0200 (CEST) Received: (qmail 770 invoked by uid 500); 28 Sep 2018 16:41:03 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 761 invoked by uid 99); 28 Sep 2018 16:41:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2018 16:41:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4B176C21A9 for ; Fri, 28 Sep 2018 16:41:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id fwXeNcls-tH3 for ; Fri, 28 Sep 2018 16:41:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id F02B55F21E for ; Fri, 28 Sep 2018 16:41:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 87FDAE0112 for ; Fri, 28 Sep 2018 16:41:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6822023FAC for ; Fri, 28 Sep 2018 16:41:00 +0000 (UTC) Date: Fri, 28 Sep 2018 16:41:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-10065) InstantiationUtil.deserializeObject(InputStream in, ClassLoader cl, boolean isFailureTolerant) will close the inputStream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-10065?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D166= 32110#comment-16632110 ]=20 ASF GitHub Bot commented on FLINK-10065: ---------------------------------------- tillrohrmann closed pull request #6498: [FLINK-10065] InstantiationUtil.des= erializeObject(InputStream in, ClassLoader cl, boolean isFailureTolerant) w= ill close the inputStream URL: https://github.com/apache/flink/pull/6498 =20 =20 =20 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/InstantiationUt= il.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, Confi= guration config, String ke =20 =09=09final ClassLoader old =3D Thread.currentThread().getContextClassLoad= er(); =09=09// not using resource try to avoid AutoClosable's close() on the giv= en stream -=09=09try (ObjectInputStream oois =3D isFailureTolerant +=09=09try { +=09=09=09ObjectInputStream oois =3D isFailureTolerant =09=09=09=09? new InstantiationUtil.FailureTolerantObjectInputStream(in, c= l) -=09=09=09=09: new InstantiationUtil.ClassLoaderObjectInputStream(in, cl)) = { +=09=09=09=09: new InstantiationUtil.ClassLoaderObjectInputStream(in, cl); =09=09=09Thread.currentThread().setContextClassLoader(cl); =09=09=09return (T) oois.readObject(); =09=09} =20 ---------------------------------------------------------------- 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. =20 For queries about this service, please contact Infrastructure at: users@infra.apache.org > InstantiationUtil.deserializeObject(InputStream in, ClassLoader cl, boole= an isFailureTolerant) will close the inputStream > -------------------------------------------------------------------------= ------------------------------------------------ > > Key: FLINK-10065 > URL: https://issues.apache.org/jira/browse/FLINK-10065 > Project: Flink > Issue Type: Bug > Reporter: Congxian Qiu > Assignee: Congxian Qiu > Priority: Major > Labels: pull-request-available > > Now, the implementation of InstantiationUtil.deserializeObject(InputStrea= m in, ClassLoader cl, boolean isFailureTolerant) is=C2=A0 > {code:java} > @SuppressWarnings("unchecked") > public static T deserializeObject(InputStream in, ClassLoader cl, boo= lean isFailureTolerant) > throws IOException, ClassNotFoundException { > final ClassLoader old =3D Thread.currentThread().getContextClassLoader(); > // not using resource try to avoid AutoClosable's close() on the given st= ream > try (ObjectInputStream oois =3D isFailureTolerant > ? new InstantiationUtil.FailureTolerantObjectInputStream(in, cl) > : new InstantiationUtil.ClassLoaderObjectInputStream(in, cl)) { > Thread.currentThread().setContextClassLoader(cl); > return (T) oois.readObject(); > } > finally { > Thread.currentThread().setContextClassLoader(old); > } > } > {code} > InputStream is closable, so the parameter will be closed after call this = method. -- This message was sent by Atlassian JIRA (v7.6.3#76005)