Skip to content

Commit

Permalink
Issue #5492 - changed from review
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Feb 18, 2021
1 parent 2aa1a68 commit f2bed13
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
Expand Up @@ -1506,16 +1506,13 @@ public void setProperty(String key, String value, String source)
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)
{
Expand Down Expand Up @@ -1545,19 +1542,6 @@ private boolean isMethodAvailable(Class<?> clazz, String methodName, Class<?>[]
}
}

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;
Expand Down

0 comments on commit f2bed13

Please sign in to comment.