This commit is contained in:
2024-11-30 19:03:49 +08:00
commit 1e6763c160
3806 changed files with 737676 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.compat;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.security.KeyStore.LoadStoreParameter;
import java.util.Collections;
import java.util.Map;
import javax.net.ssl.SSLParameters;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
class Jre8Compat extends JreCompat {
private static final Log log = LogFactory.getLog(Jre8Compat.class);
private static final StringManager sm = StringManager.getManager(Jre8Compat.class);
private static final int RUNTIME_MAJOR_VERSION = 8;
private static final Method setUseCipherSuitesOrderMethod;
private static final Constructor<?> domainLoadStoreParameterConstructor;
static {
Method m1 = null;
Constructor<?> c2 = null;
try {
// Order is important for the error handling below.
// Must look up m1 first.
// The class is Java6+...
Class<?> clazz1 = Class.forName("javax.net.ssl.SSLParameters");
// ...but this method is Java8+
m1 = clazz1.getMethod("setUseCipherSuitesOrder", boolean.class);
Class<?> clazz2 = Class.forName("java.security.DomainLoadStoreParameter");
c2 = clazz2.getConstructor(URI.class, Map.class);
} catch (SecurityException e) {
// Should never happen
log.error(sm.getString("jre8Compat.unexpected"), e);
} catch (NoSuchMethodException e) {
if (m1 == null) {
// Must be pre-Java 8
log.debug(sm.getString("jre8Compat.javaPre8"), e);
} else {
// Should never happen - signature error in lookup?
log.error(sm.getString("jre8Compat.unexpected"), e);
}
} catch (ClassNotFoundException e) {
// Should never happen
log.error(sm.getString("jre8Compat.unexpected"), e);
}
setUseCipherSuitesOrderMethod = m1;
domainLoadStoreParameterConstructor = c2;
}
static boolean isSupported() {
return setUseCipherSuitesOrderMethod != null;
}
@Override
public void setUseServerCipherSuitesOrder(SSLParameters sslParameters,
boolean useCipherSuitesOrder) {
try {
setUseCipherSuitesOrderMethod.invoke(sslParameters,
Boolean.valueOf(useCipherSuitesOrder));
} catch (IllegalArgumentException e) {
throw new UnsupportedOperationException(e);
} catch (IllegalAccessException e) {
throw new UnsupportedOperationException(e);
} catch (InvocationTargetException e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public LoadStoreParameter getDomainLoadStoreParameter(URI uri) {
try {
return (LoadStoreParameter) domainLoadStoreParameterConstructor.newInstance(
uri, Collections.EMPTY_MAP);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException |
InvocationTargetException e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public int jarFileRuntimeMajorVersion() {
return RUNTIME_MAJOR_VERSION;
}
}

View File

@@ -0,0 +1,277 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.compat;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.util.Deque;
import java.util.Set;
import java.util.jar.JarFile;
import java.util.zip.ZipFile;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
class Jre9Compat extends Jre8Compat {
private static final Log log = LogFactory.getLog(Jre9Compat.class);
private static final StringManager sm = StringManager.getManager(Jre9Compat.class);
private static final Class<?> inaccessibleObjectExceptionClazz;
private static final Method setApplicationProtocolsMethod;
private static final Method getApplicationProtocolMethod;
private static final Method setDefaultUseCachesMethod;
private static final Method bootMethod;
private static final Method configurationMethod;
private static final Method modulesMethod;
private static final Method referenceMethod;
private static final Method locationMethod;
private static final Method isPresentMethod;
private static final Method getMethod;
private static final Constructor<JarFile> jarFileConstructor;
private static final Method isMultiReleaseMethod;
private static final Object RUNTIME_VERSION;
private static final int RUNTIME_MAJOR_VERSION;
private static final Method canAccessMethod;
private static final Method getModuleMethod;
private static final Method isExportedMethod;
static {
Class<?> c1 = null;
Method m2 = null;
Method m3 = null;
Method m4 = null;
Method m5 = null;
Method m6 = null;
Method m7 = null;
Method m8 = null;
Method m9 = null;
Method m10 = null;
Method m11 = null;
Constructor<JarFile> c12 = null;
Method m13 = null;
Object o14 = null;
Object o15 = null;
Method m16 = null;
Method m17 = null;
Method m18 = null;
try {
// Order is important for the error handling below.
// Must look up c1 first.
c1 = Class.forName("java.lang.reflect.InaccessibleObjectException");
Class<?> moduleLayerClazz = Class.forName("java.lang.ModuleLayer");
Class<?> configurationClazz = Class.forName("java.lang.module.Configuration");
Class<?> resolvedModuleClazz = Class.forName("java.lang.module.ResolvedModule");
Class<?> moduleReferenceClazz = Class.forName("java.lang.module.ModuleReference");
Class<?> optionalClazz = Class.forName("java.util.Optional");
Class<?> versionClazz = Class.forName("java.lang.Runtime$Version");
Method runtimeVersionMethod = JarFile.class.getMethod("runtimeVersion");
Method majorMethod = versionClazz.getMethod("major");
m2 = SSLParameters.class.getMethod("setApplicationProtocols", String[].class);
m3 = SSLEngine.class.getMethod("getApplicationProtocol");
m4 = URLConnection.class.getMethod("setDefaultUseCaches", String.class, boolean.class);
m5 = moduleLayerClazz.getMethod("boot");
m6 = moduleLayerClazz.getMethod("configuration");
m7 = configurationClazz.getMethod("modules");
m8 = resolvedModuleClazz.getMethod("reference");
m9 = moduleReferenceClazz.getMethod("location");
m10 = optionalClazz.getMethod("isPresent");
m11 = optionalClazz.getMethod("get");
c12 = JarFile.class.getConstructor(File.class, boolean.class, int.class, versionClazz);
m13 = JarFile.class.getMethod("isMultiRelease");
o14 = runtimeVersionMethod.invoke(null);
o15 = majorMethod.invoke(o14);
m16 = AccessibleObject.class.getMethod("canAccess", new Class<?>[] { Object.class });
m17 = Class.class.getMethod("getModule");
Class<?> moduleClass = Class.forName("java.lang.Module");
m18 = moduleClass.getMethod("isExported", String.class);
} catch (ClassNotFoundException e) {
if (c1 == null) {
// Must be pre-Java 9
log.debug(sm.getString("jre9Compat.javaPre9"), e);
} else {
// Should never happen - signature error in lookup?
log.error(sm.getString("jre9Compat.unexpected"), e);
}
} catch (ReflectiveOperationException | IllegalArgumentException e) {
// Should never happen
log.error(sm.getString("jre9Compat.unexpected"), e);
}
inaccessibleObjectExceptionClazz = c1;
setApplicationProtocolsMethod = m2;
getApplicationProtocolMethod = m3;
setDefaultUseCachesMethod = m4;
bootMethod = m5;
configurationMethod = m6;
modulesMethod = m7;
referenceMethod = m8;
locationMethod = m9;
isPresentMethod = m10;
getMethod = m11;
jarFileConstructor = c12;
isMultiReleaseMethod = m13;
RUNTIME_VERSION = o14;
if (o15 != null) {
RUNTIME_MAJOR_VERSION = ((Integer) o15).intValue();
} else {
// Must be Java 8
RUNTIME_MAJOR_VERSION = 8;
}
canAccessMethod = m16;
getModuleMethod = m17;
isExportedMethod = m18;
}
static boolean isSupported() {
return inaccessibleObjectExceptionClazz != null;
}
@Override
public boolean isInstanceOfInaccessibleObjectException(Throwable t) {
if (t == null) {
return false;
}
return inaccessibleObjectExceptionClazz.isAssignableFrom(t.getClass());
}
@Override
public void setApplicationProtocols(SSLParameters sslParameters, String[] protocols) {
try {
setApplicationProtocolsMethod.invoke(sslParameters, (Object) protocols);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public String getApplicationProtocol(SSLEngine sslEngine) {
try {
return (String) getApplicationProtocolMethod.invoke(sslEngine);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public void disableCachingForJarUrlConnections() throws IOException {
try {
setDefaultUseCachesMethod.invoke(null, "JAR", Boolean.FALSE);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public void addBootModulePath(Deque<URL> classPathUrlsToProcess) {
try {
Object bootLayer = bootMethod.invoke(null);
Object bootConfiguration = configurationMethod.invoke(bootLayer);
Set<?> resolvedModules = (Set<?>) modulesMethod.invoke(bootConfiguration);
for (Object resolvedModule : resolvedModules) {
Object moduleReference = referenceMethod.invoke(resolvedModule);
Object optionalURI = locationMethod.invoke(moduleReference);
Boolean isPresent = (Boolean) isPresentMethod.invoke(optionalURI);
if (isPresent.booleanValue()) {
URI uri = (URI) getMethod.invoke(optionalURI);
try {
URL url = uri.toURL();
classPathUrlsToProcess.add(url);
} catch (MalformedURLException e) {
log.warn(sm.getString("jre9Compat.invalidModuleUri", uri), e);
}
}
}
} catch (ReflectiveOperationException e) {
throw new UnsupportedOperationException(e);
}
}
@Override
public JarFile jarFileNewInstance(File f) throws IOException {
try {
return jarFileConstructor.newInstance(
f, Boolean.TRUE, Integer.valueOf(ZipFile.OPEN_READ), RUNTIME_VERSION);
} catch (ReflectiveOperationException | IllegalArgumentException e) {
throw new IOException(e);
}
}
@Override
public boolean jarFileIsMultiRelease(JarFile jarFile) {
try {
return ((Boolean) isMultiReleaseMethod.invoke(jarFile)).booleanValue();
} catch (ReflectiveOperationException | IllegalArgumentException e) {
return false;
}
}
@Override
public int jarFileRuntimeMajorVersion() {
return RUNTIME_MAJOR_VERSION;
}
@Override
public boolean canAcccess(Object base, AccessibleObject accessibleObject) {
try {
return ((Boolean) canAccessMethod.invoke(accessibleObject, base)).booleanValue();
} catch (ReflectiveOperationException | IllegalArgumentException e) {
return false;
}
}
@Override
public boolean isExported(Class<?> type) {
try {
String packageName = type.getPackage().getName();
Object module = getModuleMethod.invoke(type);
return ((Boolean) isExportedMethod.invoke(module, packageName)).booleanValue();
} catch (ReflectiveOperationException e) {
return false;
}
}
}

View File

@@ -0,0 +1,247 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.compat;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.AccessibleObject;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.security.KeyStore.LoadStoreParameter;
import java.util.Deque;
import java.util.jar.JarFile;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLParameters;
import org.apache.tomcat.util.res.StringManager;
/**
* This is the base implementation class for JRE compatibility and provides an
* implementation based on Java 7. Sub-classes may extend this class and provide
* alternative implementations for later JRE versions
*/
public class JreCompat {
private static final int RUNTIME_MAJOR_VERSION = 7;
private static final JreCompat instance;
private static StringManager sm =
StringManager.getManager(JreCompat.class.getPackage().getName());
private static final boolean jre9Available;
private static final boolean jre8Available;
static {
// This is Tomcat 8 with a minimum Java version of Java 7. The latest
// Java version the optional features require is Java 9.
// Look for the highest supported JVM first
if (Jre9Compat.isSupported()) {
instance = new Jre9Compat();
jre9Available = true;
jre8Available = true;
}
else if (Jre8Compat.isSupported()) {
instance = new Jre8Compat();
jre9Available = false;
jre8Available = true;
} else {
instance = new JreCompat();
jre9Available = false;
jre8Available = false;
}
}
public static JreCompat getInstance() {
return instance;
}
// Java 7 implementation of Java 8 methods
public static boolean isJre8Available() {
return jre8Available;
}
@SuppressWarnings("unused")
public void setUseServerCipherSuitesOrder(SSLParameters engine, boolean useCipherSuitesOrder) {
throw new UnsupportedOperationException(sm.getString("jreCompat.noServerCipherSuiteOrder"));
}
@SuppressWarnings("unused")
public LoadStoreParameter getDomainLoadStoreParameter(URI uri) {
throw new UnsupportedOperationException(sm.getString("jreCompat.noDomainLoadStoreParameter"));
}
// Java 7 implementation of Java 9 methods
public static boolean isJre9Available() {
return jre9Available;
}
/**
* Test if the provided exception is an instance of
* java.lang.reflect.InaccessibleObjectException.
*
* @param t The exception to test
*
* @return {@code true} if the exception is an instance of
* InaccessibleObjectException, otherwise {@code false}
*/
public boolean isInstanceOfInaccessibleObjectException(Throwable t) {
// Exception does not exist prior to Java 9
return false;
}
/**
* Set the application protocols the server will accept for ALPN
*
* @param sslParameters The SSL parameters for a connection
* @param protocols The application protocols to be allowed for that
* connection
*/
public void setApplicationProtocols(SSLParameters sslParameters, String[] protocols) {
throw new UnsupportedOperationException(sm.getString("jreCompat.noApplicationProtocols"));
}
/**
* Get the application protocol that has been negotiated for connection
* associated with the given SSLEngine.
*
* @param sslEngine The SSLEngine for which to obtain the negotiated
* protocol
*
* @return The name of the negotiated protocol
*/
public String getApplicationProtocol(SSLEngine sslEngine) {
throw new UnsupportedOperationException(sm.getString("jreCompat.noApplicationProtocol"));
}
/**
* Disables caching for JAR URL connections. For Java 8 and earlier, this also disables
* caching for ALL URL connections.
*
* @throws IOException If a dummy JAR URLConnection can not be created
*/
public void disableCachingForJarUrlConnections() throws IOException {
// Doesn't matter that this JAR doesn't exist - just as
// long as the URL is well-formed
URL url = new URL("jar:file://dummy.jar!/");
URLConnection uConn = url.openConnection();
uConn.setDefaultUseCaches(false);
}
/**
* Obtains the URLs for all the JARs on the module path when the JVM starts
* and adds them to the provided Deque.
*
* @param classPathUrlsToProcess The Deque to which the modules should be
* added
*/
public void addBootModulePath(Deque<URL> classPathUrlsToProcess) {
// NO-OP for Java 7. There is no module path.
}
/**
* Creates a new JarFile instance. When running on Java 9 and later, the
* JarFile will be multi-release JAR aware. While this isn't strictly
* required to be in this package, it is provided as a convenience method.
*
* @param s The JAR file to open
*
* @return A JarFile instance based on the provided path
*
* @throws IOException If an I/O error occurs creating the JarFile instance
*/
public final JarFile jarFileNewInstance(String s) throws IOException {
return jarFileNewInstance(new File(s));
}
/**
* Creates a new JarFile instance. When running on Java 9 and later, the
* JarFile will be multi-release JAR aware.
*
* @param f The JAR file to open
*
* @return A JarFile instance based on the provided file
*
* @throws IOException If an I/O error occurs creating the JarFile instance
*/
public JarFile jarFileNewInstance(File f) throws IOException {
return new JarFile(f);
}
/**
* Is this JarFile a multi-release JAR file.
*
* @param jarFile The JarFile to test
*
* @return {@code true} If it is a multi-release JAR file and is configured
* to behave as such.
*/
public boolean jarFileIsMultiRelease(JarFile jarFile) {
// Java 8 doesn't support multi-release so default to false
return false;
}
public int jarFileRuntimeMajorVersion() {
return RUNTIME_MAJOR_VERSION;
}
/**
* Is the accessibleObject accessible (as a result of appropriate module
* exports) on the provided instance?
*
* @param base The specific instance to be tested.
* @param accessibleObject The method/field/constructor to be tested.
*
* @return {code true} if the AccessibleObject can be accessed otherwise
* {code false}
*/
public boolean canAcccess(Object base, AccessibleObject accessibleObject) {
// Java 8 doesn't support modules so default to true
return true;
}
/**
* Is the given class in an exported package?
*
* @param type The class to test
*
* @return Always {@code true} for Java 8. {@code true} if the enclosing
* package is exported for Java 9+
*/
public boolean isExported(Class<?> type) {
return true;
}
}

View File

@@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.compat;
import java.security.AccessController;
import java.security.PrivilegedAction;
public class JrePlatform {
private static final String OS_NAME_PROPERTY = "os.name";
private static final String OS_NAME_WINDOWS_PREFIX = "Windows";
static {
/*
* There are a few places where a) the behaviour of the Java API depends
* on the underlying platform and b) those behavioural differences have
* an impact on Tomcat.
*
* Tomcat therefore needs to be able to determine the platform it is
* running on to account for those differences.
*
* In an ideal world this code would not exist.
*/
// This check is derived from the check in Apache Commons Lang
String osName;
if (System.getSecurityManager() == null) {
osName = System.getProperty(OS_NAME_PROPERTY);
} else {
osName = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty(OS_NAME_PROPERTY);
}
});
}
IS_WINDOWS = osName.startsWith(OS_NAME_WINDOWS_PREFIX);
}
public static final boolean IS_WINDOWS;
}

View File

@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.compat;
import java.util.Locale;
public class JreVendor {
static {
/**
* There are a few places where Tomcat either accesses JVM internals
* (e.g. the memory leak protection) or where feature support varies
* between JVMs (e.g. SPNEGO). These flags exist to enable Tomcat to
* adjust its behaviour based on the vendor of the JVM. In an ideal
* world this code would not exist.
*/
String vendor = System.getProperty("java.vendor", "");
vendor = vendor.toLowerCase(Locale.ENGLISH);
if (vendor.startsWith("oracle") || vendor.startsWith("sun")) {
IS_ORACLE_JVM = true;
IS_IBM_JVM = false;
} else if (vendor.contains("ibm")) {
IS_ORACLE_JVM = false;
IS_IBM_JVM = true;
} else {
IS_ORACLE_JVM = false;
IS_IBM_JVM = false;
}
}
public static final boolean IS_ORACLE_JVM;
public static final boolean IS_IBM_JVM;
}

View File

@@ -0,0 +1,26 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jre8Compat.javaPre8=Class not found so assuming code is running on a pre-Java 8 JVM
jre8Compat.unexpected=Failed to create references to Java 8 classes and methods
jre9Compat.invalidModuleUri=The module URI provided [{0}] could not be converted to a URL for the JarScanner to process
jre9Compat.javaPre9=Class not found so assuming code is running on a pre-Java 9 JVM
jre9Compat.unexpected=Failed to create references to Java 9 classes and methods
jreCompat.noApplicationProtocol=Java Runtime does not support SSLEngine.getApplicationProtocol(). You must use Java 9 to use this feature.
jreCompat.noApplicationProtocols=Java Runtime does not support SSLParameters.setApplicationProtocols(). You must use Java 9 to use this feature.
jreCompat.noDomainLoadStoreParameter=Java Runtime does not support DKS key store type. You must use Java 8 or later to use this feature.
jreCompat.noServerCipherSuiteOrder=Java Runtime does not support "useServerCipherSuitesOrder". You must use Java 8 or later to use this feature.

View File

@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jreCompat.noApplicationProtocol=Die Java Runtime unterstützt nicht den SSLEngine.getApplicationProtocol() Aufruf. Um dieses Feature nutzen zu können muss Java 9 verwendet werden.

View File

@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jre9Compat.invalidModuleUri=El módulo URI proveído [{0}] no pudo ser convertiod a una URL para ser procesado por JarScanner
jreCompat.noApplicationProtocol=Java Runtime no soporta SSLEngine.getApplicationProtocol(). Se necesita Java 9 para usar esta función.

View File

@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jre9Compat.invalidModuleUri=L''URI du module fournie [{0}] n''a pas pu être convertie en URL pour être traitée par le JarScanner
jre9Compat.javaPre9=Le code est considéré être exécuté sur une JVM antérieure à Java 9 car la classe n'a pas été trouvée
jre9Compat.unexpected=Impossible de créer les références vers les classes et méthodes de Java 9
jreCompat.noApplicationProtocol=Le Java Runtime utilisé ne supporte pas SSLEngine.getApplicationProtocol(). Il faut Java 9 pour utiliser cette option.
jreCompat.noApplicationProtocols=L'environnement Java ne supporte pas SSLParameters.setApplicationProtocols(), cette fonctionnalité demande Java 9

View File

@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jre9Compat.invalidModuleUri=モジュール URI [{0}] を JarScanner で処理する URL に変換できませんでした。
jreCompat.noApplicationProtocol=Java 実行環境が SSLEngine.getApplicationProtocol() に対応していません。Java 9 以降で実行する必要があります。
jreCompat.noApplicationProtocols=\n\
113/5000\n\
Java RuntimeはSSLParameters.setApplicationProtocols()をサポートしていません。 この機能を使用するには、Java 9を使用する必要があります。

View File

@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jre9Compat.invalidModuleUri=[{0}](으)로 제공된 모듈 URI는 JarScanner가 처리할 수 있는 URL로 변환될 수 없습니다.
jre9Compat.javaPre9=Java 9 클래스가 발견되지 않습니다. Java 9 이전 버전에서 동작하고 있는 것으로 보입니다.
jre9Compat.unexpected=Java 9 클래스들과 메소드들을 참조할 수 없습니다.
jreCompat.noApplicationProtocol=자바 런타임이 SSLEngine.getApplicationProtocol()을 지원하지 않습니다. 이 기능을 사용하려면 Java 9를 사용해야 합니다.
jreCompat.noApplicationProtocols=자바 런타임이 SSLParameters.setApplicationProtocols()을 지원하지 않습니다. 이 기능을 사용하려면 Java 9를 사용해야 합니다.

View File

@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jre9Compat.invalidModuleUri=提供的模块URI [{0}]无法转换为JarScanner要处理的URL
jre9Compat.javaPre9=类未找到所以假设代码运行在pre-Java 8虚拟机上
jre9Compat.unexpected=创建对Java 9类的依赖和方法失败
jreCompat.noApplicationProtocol=Java 运行时不支持 SSLEngine.getApplicationProtocol()。要使用该功能你必须使用 Java 9。

View File

@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomcat.util.compat;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
import org.apache.tomcat.util.net.Constants;
/**
* This class checks for the availability of TLS features.
*
* @deprecated Unused. This will be removed in Tomcat 10.
*/
@Deprecated
public class TLS {
private static final boolean tlsv13Available;
static {
boolean ok = false;
try {
SSLContext.getInstance(Constants.SSL_PROTO_TLSv1_3);
ok = true;
} catch (NoSuchAlgorithmException ex) {
}
tlsv13Available = ok;
}
public static boolean isTlsv13Available() {
return tlsv13Available;
}
}