Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A739517A9E for ; Wed, 22 Oct 2014 19:29:28 +0000 (UTC) Received: (qmail 29236 invoked by uid 500); 22 Oct 2014 19:29:28 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 29157 invoked by uid 500); 22 Oct 2014 19:29:28 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 29147 invoked by uid 99); 22 Oct 2014 19:29:28 -0000 Received: from mx1-us-east.apache.org (HELO mx1-us-east.apache.org) (54.164.171.186) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Oct 2014 19:29:28 +0000 Received: from mx1-us-east.apache.org (localhost [127.0.0.1]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 1DAD742DFB for ; Wed, 22 Oct 2014 19:29:50 +0000 (UTC) Received: by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org, from userid 111) id 1349143AC9; Wed, 22 Oct 2014 19:29:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mx1-us-east.apache.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=10.0 tests=RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from eris.apache.org (eris.apache.org [140.211.11.4]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 9F3B2435BE for ; Wed, 22 Oct 2014 19:29:49 +0000 (UTC) Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6D7FC238897A for ; Wed, 22 Oct 2014 19:29:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1633688 - in /tomcat/trunk: java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java webapps/docs/changelog.xml Date: Wed, 22 Oct 2014 19:29:26 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141022192926.6D7FC238897A@eris.apache.org> X-Virus-Scanned: ClamAV using ClamSMTP Author: markt Date: Wed Oct 22 19:29:25 2014 New Revision: 1633688 URL: http://svn.apache.org/r1633688 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57091 Work around the behaviour of the Oracle JRE when creating new threads in an applet environment that breaks the WebSocket client implementation. Patch provided by Niklas Hallqvist. Modified: tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java?rev=1633688&r1=1633687&r2=1633688&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java (original) +++ tomcat/trunk/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java Wed Oct 22 19:29:25 2014 @@ -18,6 +18,8 @@ package org.apache.tomcat.websocket; import java.io.IOException; import java.nio.channels.AsynchronousChannelGroup; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.concurrent.ExecutorService; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadFactory; @@ -106,12 +108,21 @@ public class AsyncChannelGroupUtil { private AtomicInteger count = new AtomicInteger(0); @Override - public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setName("WebSocketClient-AsyncIO-" + count.incrementAndGet()); - t.setContextClassLoader(this.getClass().getClassLoader()); - t.setDaemon(true); - return t; + public Thread newThread(final Runnable r) { + // Create the new Thread within a doPrivileged block to ensure that + // the thread inherits the current ProtectionDomain which is + // essential to be able to use this with a Java Applet. See + // https://issues.apache.org/bugzilla/show_bug.cgi?id=57091 + return AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Thread run() { + Thread t = new Thread(r); + t.setName("WebSocketClient-AsyncIO-" + count.incrementAndGet()); + t.setContextClassLoader(this.getClass().getClassLoader()); + t.setDaemon(true); + return t; + } + }); } } } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1633688&r1=1633687&r2=1633688&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Oct 22 19:29:25 2014 @@ -233,6 +233,11 @@ Add null checks for arguments in remote endpoint. (remm/kkolinko) + 57091: Work around the behaviour of the Oracle JRE when + creating new threads in an applet environment that breaks the WebSocket + client implementation. Patch provided by Niklas Hallqvist. (markt) + + 57118: Ensure that that an EncodeException is thrown by RemoteEndpoint.Basic.sendObject(Object) rather than an IOException when no suitable Encoder --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org