Issue #5492 - changed from review

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2021-02-18 11:14:54 -06:00
parent 2aa1a68079
commit f2bed1368b
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 3 additions and 19 deletions

View File

@ -1506,16 +1506,13 @@ public class StartArgs
JavaVersion ver = JavaVersion.parse(value);
properties.setProperty("java.version.platform", Integer.toString(ver.getPlatform()), source);
// features built into java.
// In Jetty 10+ these will always be true, but still need to stick around for users that
// want to move between Jetty 9.4.x and 10.0.x+
properties.setProperty("runtime.feature.alpn", Boolean.toString(isMethodAvailable(javax.net.ssl.SSLParameters.class, "getApplicationProtocols", null)), source);
properties.setProperty("runtime.feature.jpms", Boolean.toString(isClassAvailable("java.lang.ModuleLayer")), source);
// @deprecated - below will be removed in Jetty 10.x
properties.setProperty("java.version.major", Integer.toString(ver.getMajor()), "Deprecated");
properties.setProperty("java.version.minor", Integer.toString(ver.getMinor()), "Deprecated");
properties.setProperty("java.version.micro", Integer.toString(ver.getMicro()), "Deprecated");
// ALPN feature exists
properties.setProperty("runtime.feature.alpn", Boolean.toString(isMethodAvailable(javax.net.ssl.SSLParameters.class, "getApplicationProtocols", null)), source);
}
catch (Throwable x)
{
@ -1545,19 +1542,6 @@ public class StartArgs
}
}
private boolean isClassAvailable(String clazzname)
{
try
{
Class.forName(clazzname, false, this.getClass().getClassLoader());
return true;
}
catch (ClassNotFoundException e)
{
return false;
}
}
public void setRun(boolean run)
{
this.run = run;