You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2013/09/08 11:43:28 UTC
svn commit: r1520848 - in /jmeter/trunk/src:
jorphan/org/apache/jorphan/exec/KeyToolUtils.java
protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
Author: sebb
Date: Sun Sep 8 09:43:27 2013
New Revision: 1520848
URL: http://svn.apache.org/r1520848
Log:
Move System version check where it belongs
Modified:
jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.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=1520848&r1=1520847&r2=1520848&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 09:43:27 2013
@@ -27,6 +27,9 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.JavaVersion;
+import org.apache.commons.lang3.SystemUtils;
+
/**
* Utilities for working with Java keytool
*/
@@ -41,6 +44,10 @@ public class KeyToolUtils {
private static final String ROOT_ALIAS = "root"; // $NON-NLS-1$
private static final String CA_ALIAS = "ca"; // $NON-NLS-1$
+ /** Does this class support generation of host certificates? */
+ public static final boolean SUPPORTS_HOST_CERT = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7);
+ // i.e. does keytool support -gencert and -ext ?
+
private KeyToolUtils() {
// not instantiable
}
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=1520848&r1=1520847&r2=1520848&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 09:43:27 2013
@@ -45,9 +45,7 @@ import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.JavaVersion;
import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.lang3.SystemUtils;
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.protocol.http.parser.HTMLParseException;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
@@ -115,9 +113,6 @@ public class Proxy extends Thread {
private static final int CERT_VALIDITY = JMeterUtils.getPropDefault("proxy.cert.validity", 7); // $NON-NLS-1$
- // Are we running on a system that supports keytool -gencert and -ext options ?
- private static final boolean isAtLeastJava7 = SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7);
-
private static final String DEFAULT_PASSWORD = "password"; // $NON-NLS-1$
private static final SamplerCreatorFactory factory = new SamplerCreatorFactory();
@@ -147,7 +142,7 @@ public class Proxy extends Thread {
log.info("Proxy Server will use the specified SSL keystore with the alias: '" + CERT_ALIAS + "'");
keystoreType = KEYSTORE_IMPL.USER_KEYSTORE;
} else {
- if (isAtLeastJava7) {
+ if (KeyToolUtils.SUPPORTS_HOST_CERT) {
keystoreType = KEYSTORE_IMPL.DYNAMIC_KEYSTORE;
log.info("Java 7 detected: Proxy Server SSL Proxy will use keys that support embedded 3rd party resources");
} else {