You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2013/09/08 22:38:06 UTC

Re: svn commit: r1520915 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java

On 8 September 2013 21:10,  <pm...@apache.org> wrote:
> Author: pmouawad
> Date: Sun Sep  8 20:10:54 2013
> New Revision: 1520915
>
> URL: http://svn.apache.org/r1520915
> Log:
> Test value of File#delete and throw if cannot delete it
>
> Modified:
>     jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
>
> Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1520915&r1=1520914&r2=1520915&view=diff
> ==============================================================================
> --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
> +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Sun Sep  8 20:10:54 2013
> @@ -429,7 +429,10 @@ public class Proxy extends Thread {
>                  log.info(port + "Created keystore in " + canonicalPath);
>              } else {
>                  log.info(port + "Generating standard keypair in " + canonicalPath);
> -                certFile.delete(); // Must not exist
> +                // Must not exist
> +                if(!certFile.delete()) {
> +                    throw new IOException("Could not delete file:"+certFile.getAbsolutePath()+", this is needed for certificate generation");
> +                }

Same issue here - won't delete return false if the file does not exist?
Again, I think failure can be left to the genkeypair() method to report.

>                  KeyToolUtils.genkeypair(certFile, JMETER_SERVER_ALIAS, keyStorePass, CERT_VALIDITY, null, null);
>              }
>              keyStore = getKeyStore(keyStorePass.toCharArray()); // This should now work
>
>

Re: svn commit: r1520915 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello sebb,
Good catch.
I added an existence test, same for other issue

Regards
Philippe


On Sun, Sep 8, 2013 at 10:38 PM, sebb <se...@gmail.com> wrote:

> On 8 September 2013 21:10,  <pm...@apache.org> wrote:
> > Author: pmouawad
> > Date: Sun Sep  8 20:10:54 2013
> > New Revision: 1520915
> >
> > URL: http://svn.apache.org/r1520915
> > Log:
> > Test value of File#delete and throw if cannot delete it
> >
> > Modified:
> >
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
> >
> > Modified:
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
> > URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1520915&r1=1520914&r2=1520915&view=diff
> >
> ==============================================================================
> > ---
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
> (original)
> > +++
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
> Sun Sep  8 20:10:54 2013
> > @@ -429,7 +429,10 @@ public class Proxy extends Thread {
> >                  log.info(port + "Created keystore in " +
> canonicalPath);
> >              } else {
> >                  log.info(port + "Generating standard keypair in " +
> canonicalPath);
> > -                certFile.delete(); // Must not exist
> > +                // Must not exist
> > +                if(!certFile.delete()) {
> > +                    throw new IOException("Could not delete
> file:"+certFile.getAbsolutePath()+", this is needed for certificate
> generation");
> > +                }
>
> Same issue here - won't delete return false if the file does not exist?
> Again, I think failure can be left to the genkeypair() method to report.
>
> >                  KeyToolUtils.genkeypair(certFile, JMETER_SERVER_ALIAS,
> keyStorePass, CERT_VALIDITY, null, null);
> >              }
> >              keyStore = getKeyStore(keyStorePass.toCharArray()); // This
> should now work
> >
> >
>



-- 
Cordialement.
Philippe Mouawad.