Mark, On 2/28/15 2:38 PM, ma...@apache.org wrote: > Author: markt > Date: Sat Feb 28 19:38:30 2015 > New Revision: 1662994 > > URL: http://svn.apache.org/r1662994 > Log: > Remove dependency on SSLServerSocket.getSSLParameters() which is only > available from Java 7 onwards. > > Modified: > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java > > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java > > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties > > Modified: > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java > URL: > http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1662994&r1=1662993&r2=1662994&view=diff > ============================================================================== > --- > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java > (original) > +++ > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java > Sat Feb 28 19:38:30 2015 > @@ -18,8 +18,6 @@ package org.apache.tomcat.util.net; > > import java.io.File; > import java.io.OutputStreamWriter; > -import java.lang.reflect.InvocationTargetException; > -import java.lang.reflect.Method; > import java.net.InetAddress; > import java.net.InetSocketAddress; > import java.util.ArrayList; > @@ -30,10 +28,10 @@ import java.util.concurrent.TimeUnit; > > import javax.net.ssl.KeyManagerFactory; > import javax.net.ssl.SSLEngine; > -import javax.net.ssl.SSLParameters; > > import org.apache.juli.logging.Log; > import org.apache.tomcat.util.IntrospectionUtils; > +import org.apache.tomcat.util.compat.JreCompat; > import org.apache.tomcat.util.net.AbstractEndpoint.Acceptor.AcceptorState; > import org.apache.tomcat.util.res.StringManager; > import org.apache.tomcat.util.threads.LimitLatch; > @@ -656,15 +654,9 @@ public abstract class AbstractEndpoint<S > private void testServerCipherSuitesOrderSupport() { > // Only test this feature if the user explicitly requested its use. > if(!"".equals(getUseServerCipherSuitesOrder().trim())) { > - try { > - // This method is only available in Java 8+ > - // Check to see if the method exists, and then call it. > - SSLParameters.class.getMethod("setUseCipherSuitesOrder", > - Boolean.TYPE); > - } > - catch (NoSuchMethodException nsme) { > - throw new > UnsupportedOperationException(sm.getString("endpoint.jsse.cannotHonorServerCipherOrder"), > - nsme); > + if (JreCompat.isJre8Available()) { > + throw new UnsupportedOperationException( > + > sm.getString("endpoint.jsse.cannotHonorServerCipherOrder"));
It may be a bit pedantic, but would it be better to check for the Java version (as above), or for the presence of the method? I feel like the availability of the method is more important than the runtime version of Java, though the API is much more well-defined than, say, Javascript where version-checking is always a bad idea. I'm happy to leave it this way, but I feel it is a bit ... sloppy? I dunno... is mine just an academic concern? -chris
signature.asc
Description: OpenPGP digital signature