From dev-return-189533-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Fri Mar 9 13:13:47 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 63ECA18064A for ; Fri, 9 Mar 2018 13:13:47 +0100 (CET) Received: (qmail 64081 invoked by uid 500); 9 Mar 2018 12:13:46 -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 64071 invoked by uid 99); 9 Mar 2018 12:13:46 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2018 12:13:46 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 5A66E3A0116 for ; Fri, 9 Mar 2018 12:13:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1826336 - in /tomcat/trunk: java/org/apache/catalina/startup/Bootstrap.java java/org/apache/catalina/startup/ContextConfig.java res/findbugs/filter-false-positives.xml Date: Fri, 09 Mar 2018 12:13:44 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180309121345.5A66E3A0116@svn01-us-west.apache.org> Author: markt Date: Fri Mar 9 12:13:44 2018 New Revision: 1826336 URL: http://svn.apache.org/viewvc?rev=1826336&view=rev Log: Fix some more SpotBugs warnings Modified: tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java tomcat/trunk/res/findbugs/filter-false-positives.xml Modified: tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?rev=1826336&r1=1826335&r2=1826336&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java Fri Mar 9 12:13:44 2018 @@ -54,7 +54,8 @@ public final class Bootstrap { /** * Daemon object used by main. */ - private static Bootstrap daemon = null; + private static final Object daemonLock = new Object(); + private static volatile Bootstrap daemon = null; private static final File catalinaBaseFile; private static final File catalinaHomeFile; @@ -176,8 +177,7 @@ public final class Bootstrap { try { @SuppressWarnings("unused") URL url = new URL(repository); - repositories.add( - new Repository(repository, RepositoryType.URL)); + repositories.add(new Repository(repository, RepositoryType.URL)); continue; } catch (MalformedURLException e) { // Ignore @@ -187,14 +187,11 @@ public final class Bootstrap { if (repository.endsWith("*.jar")) { repository = repository.substring (0, repository.length() - "*.jar".length()); - repositories.add( - new Repository(repository, RepositoryType.GLOB)); + repositories.add(new Repository(repository, RepositoryType.GLOB)); } else if (repository.endsWith(".jar")) { - repositories.add( - new Repository(repository, RepositoryType.JAR)); + repositories.add(new Repository(repository, RepositoryType.JAR)); } else { - repositories.add( - new Repository(repository, RepositoryType.DIR)); + repositories.add(new Repository(repository, RepositoryType.DIR)); } } @@ -456,22 +453,24 @@ public final class Bootstrap { */ public static void main(String args[]) { - if (daemon == null) { - // Don't set daemon until init() has completed - Bootstrap bootstrap = new Bootstrap(); - try { - bootstrap.init(); - } catch (Throwable t) { - handleThrowable(t); - t.printStackTrace(); - return; + synchronized (daemonLock) { + if (daemon == null) { + // Don't set daemon until init() has completed + Bootstrap bootstrap = new Bootstrap(); + try { + bootstrap.init(); + } catch (Throwable t) { + handleThrowable(t); + t.printStackTrace(); + return; + } + daemon = bootstrap; + } else { + // When running as a service the call to stop will be on a new + // thread so make sure the correct class loader is used to + // prevent a range of class not found exceptions. + Thread.currentThread().setContextClassLoader(daemon.catalinaLoader); } - daemon = bootstrap; - } else { - // When running as a service the call to stop will be on a new - // thread so make sure the correct class loader is used to prevent - // a range of class not found exceptions. - Thread.currentThread().setContextClassLoader(daemon.catalinaLoader); } try { Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1826336&r1=1826335&r2=1826336&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Mar 9 12:13:44 2018 @@ -182,7 +182,7 @@ public class ContextConfig implements Li /** * The Context we are associated with. */ - protected Context context = null; + protected volatile Context context = null; /** @@ -713,7 +713,7 @@ public class ContextConfig implements Li /** * Process a "init" event for this Context. */ - protected void init() { + protected synchronized void init() { // Called from StandardContext.init() Digester contextDigester = createContextDigester(); Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1826336&r1=1826335&r2=1826336&view=diff ============================================================================== --- tomcat/trunk/res/findbugs/filter-false-positives.xml (original) +++ tomcat/trunk/res/findbugs/filter-false-positives.xml Fri Mar 9 12:13:44 2018 @@ -462,6 +462,12 @@ + + + + + + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org