From dev-return-2486-apmail-jmeter-dev-archive=jmeter.apache.org@jmeter.apache.org Sun Sep 8 20:34:30 2013 Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CD1C510998 for ; Sun, 8 Sep 2013 20:34:30 +0000 (UTC) Received: (qmail 60919 invoked by uid 500); 8 Sep 2013 20:34:30 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 60815 invoked by uid 500); 8 Sep 2013 20:34:29 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 60807 invoked by uid 99); 8 Sep 2013 20:34:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Sep 2013 20:34:28 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 74.125.82.51 as permitted sender) Received: from [74.125.82.51] (HELO mail-wg0-f51.google.com) (74.125.82.51) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Sep 2013 20:34:23 +0000 Received: by mail-wg0-f51.google.com with SMTP id a12so4523670wgh.6 for ; Sun, 08 Sep 2013 13:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=fJCQwe+17p5if6E116jap1BGWBQ8tt+zZh0pgITk8t8=; b=GHhiv36Y3/5mQue21IMSF+YSlZrATNATXXzfwSBLz5mCVrDIQ5TwNAgH0eWK2idbqm /3RsSLfBtwqZPw9UqPhW8DXAbKqmD/E6KVslEiU1WbTjAC/rELPaZlyrlDmgQeRE+6dO IsvVKHvI7msByMW5Jq9sUf20SqWA2TEZDbi6BktZQ5oXPi0aDveXztvTqr5DBESmruSY ihHJ8SCIMTTE2hxzx8OcJKhwmZ3mqaChpzMPALAtDA3fHSA+KFUztAkw3jNzKuaBpGm7 wQDQjxNrT8KlRyPuHURyYf1h94310vO0SmB1lF14tdfaj0Dw+9wQiOfxraxR4lD4mYmw RXOg== MIME-Version: 1.0 X-Received: by 10.181.12.75 with SMTP id eo11mr6003417wid.24.1378672442511; Sun, 08 Sep 2013 13:34:02 -0700 (PDT) Received: by 10.194.24.99 with HTTP; Sun, 8 Sep 2013 13:34:02 -0700 (PDT) In-Reply-To: <20130908200945.64FEC2388A29@eris.apache.org> References: <20130908200945.64FEC2388A29@eris.apache.org> Date: Sun, 8 Sep 2013 21:34:02 +0100 Message-ID: Subject: Re: svn commit: r1520912 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java From: sebb To: dev@jmeter.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On 8 September 2013 21:09, wrote: > Author: pmouawad > Date: Sun Sep 8 20:09:45 2013 > New Revision: 1520912 > > URL: http://svn.apache.org/r1520912 > Log: > Test value of File#delete > > Modified: > jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java > > Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java?rev=1520912&r1=1520911&r2=1520912&view=diff > ============================================================================== > --- jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java (original) > +++ jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java Sun Sep 8 20:09:45 2013 > @@ -29,11 +29,14 @@ import java.util.List; > > import org.apache.commons.lang3.JavaVersion; > import org.apache.commons.lang3.SystemUtils; > +import org.apache.jorphan.logging.LoggingManager; > +import org.apache.log.Logger; > > /** > * Utilities for working with Java keytool > */ > public class KeyToolUtils { > + private static final Logger log = LoggingManager.getLoggerForClass(); > > // The DNAME which is used if none is provided > private static final String DEFAULT_DNAME = "cn=JMeter Proxy (DO NOT TRUST)"; // $NON-NLS-1$ > @@ -114,8 +117,11 @@ public class KeyToolUtils { > */ > public static void generateProxyCA(File keystore, String password, int validity) throws IOException { > keystore.delete(); // any existing entries will be invalidated anyway > - new File(CACERT).delete(); // not strictly needed > - > + // not strictly needed > + if(!new File(CACERT).delete()) { > + // Noop as we accept not to be able to delete it > + log.warn("Could not delete file:"+new File(CACERT).getAbsolutePath()+", will continue ignoring this"); > + } What if the file does not exist? Won't that cause delete() to return false? I think it's better to ignore the return code; the gencert command will detect any problems (e.g. read-only .crt file) > // Create the self-signed keypairs (requires Java 7 for -ext flag) > KeyToolUtils.genkeypair(keystore, ROOT_ALIAS, password, validity, DNAME_ROOT_KEY, "bc:c"); > KeyToolUtils.genkeypair(keystore, CA_ALIAS, password, validity, DNAME_CA_KEY, "bc:c"); > >