Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EDBE1200CD6 for ; Mon, 31 Jul 2017 18:54:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EC47A1639FD; Mon, 31 Jul 2017 16:54:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3D2911639E7 for ; Mon, 31 Jul 2017 18:54:09 +0200 (CEST) Received: (qmail 27979 invoked by uid 500); 31 Jul 2017 16:54:08 -0000 Mailing-List: contact commits-help@beam.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.apache.org Delivered-To: mailing list commits@beam.apache.org Received: (qmail 27970 invoked by uid 99); 31 Jul 2017 16:54:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Jul 2017 16:54:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id DEEF71A1F81 for ; Mon, 31 Jul 2017 16:54:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id UbSOsyD_bHu8 for ; Mon, 31 Jul 2017 16:54:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 6484D5F523 for ; Mon, 31 Jul 2017 16:54:06 +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 A770CE0059 for ; Mon, 31 Jul 2017 16:54:05 +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 57C532464D for ; Mon, 31 Jul 2017 16:54:00 +0000 (UTC) Date: Mon, 31 Jul 2017 16:54:00 +0000 (UTC) From: "Romain Manni-Bucau (JIRA)" To: commits@beam.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (BEAM-2701) use a custom implementation of java.io.ObjectInputStream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 31 Jul 2017 16:54:10 -0000 Romain Manni-Bucau created BEAM-2701: ---------------------------------------- Summary: use a custom implementation of java.io.ObjectInputStream Key: BEAM-2701 URL: https://issues.apache.org/jira/browse/BEAM-2701 Project: Beam Issue Type: Bug Components: sdk-java-core Reporter: Romain Manni-Bucau Assignee: Davor Bonaci java.io.ObjectInputStream should override resolve[Proxy]Class using the TCCL to support any classloader and not fallback into some JVM pitfall using another classloader (default). This will enable beam to use any classloader instead of requiring to run in the JVM using java serialization. {code} @Override protected Class resolveClass(final ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { final String n = classDesc.getName(); final ClassLoader classloader = getClassloader(); try { return Class.forName(n, false, classloader); } catch (ClassNotFoundException e) { if (n.equals("boolean")) { return boolean.class; } if (n.equals("byte")) { return byte.class; } if (n.equals("char")) { return char.class; } if (n.equals("short")) { return short.class; } if (n.equals("int")) { return int.class; } if (n.equals("long")) { return long.class; } if (n.equals("float")) { return float.class; } if (n.equals("double")) { return double.class; } //Last try - Let runtime try and find it. return Class.forName(n, false, null); } } @Override protected Class resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException { final Class[] cinterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { cinterfaces[i] = getClassloader().loadClass(interfaces[i]); } try { return Proxy.getProxyClass(getClassloader(), cinterfaces); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } } {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)