On 1 March 2015 at 13:57,  <[email protected]> wrote:
> Author: pmouawad
> Date: Sun Mar  1 13:57:44 2015
> New Revision: 1663105
>
> URL: http://svn.apache.org/r1663105
> Log:
> Check delete result
>
> Modified:
>     
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
>
> Modified: 
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1663105&r1=1663104&r2=1663105&view=diff
> ==============================================================================
> --- 
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
>  (original)
> +++ 
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
>  Sun Mar  1 13:57:44 2015
> @@ -1488,7 +1488,9 @@ public class ProxyControl extends Generi
>              keyPassword = storePassword; // we use same password for both
>              setPassword(storePassword);
>              log.info("Generating standard keypair in " + CERT_PATH_ABS);
> -            CERT_PATH.delete(); // safer to start afresh
> +            if(!CERT_PATH.delete()){ // safer to start afresh
> +                log.warn("Could not delete "+CERT_PATH.getAbsolutePath()+", 
> this could create issues, stop jmeter, ensure file is deleted and restart 
> again");

The check is not secure; delete() only returns true if the file was deleted.
If the file did not exist, delete() returns false, in which case the
log message is misleading.

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

Reply via email to