Code Style for Jetty modules Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
diff --git a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java index 63663fb..4b80825 100644 --- a/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java +++ b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerProvider.java
@@ -31,15 +31,13 @@ */ public final class JettyHttpContainerProvider implements ContainerProvider { + public static final String HANDLER_NAME = "org.eclipse.jetty.server.Handler"; @Override public <T> T createContainer(final Class<T> type, final Application application) throws ProcessingException { if (JdkVersion.getJdkVersion().getMajor() < 11) { throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); } - if (type != null - && ("org.eclipse.jetty.server.Handler".equalsIgnoreCase(type.getCanonicalName()) - || JettyHttpContainer.class == type) - ) { + if (type != null && (HANDLER_NAME.equalsIgnoreCase(type.getCanonicalName()) || JettyHttpContainer.class == type)) { return type.cast(new JettyHttpContainer(application)); } return null; @@ -50,10 +48,7 @@ if (JdkVersion.getJdkVersion().getMajor() < 11) { throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); } - if (type != null - && ("org.eclipse.jetty.server.Handler".equalsIgnoreCase(type.getCanonicalName()) - || JettyHttpContainer.class == type) - ) { + if (type != null && (HANDLER_NAME.equalsIgnoreCase(type.getCanonicalName()) || JettyHttpContainer.class == type)) { return type.cast(new JettyHttpContainer(application, parentContext)); } return null;
diff --git a/containers/jetty-http2/src/main/java/org/glassfish/jersey/jetty/http2/JettyHttp2ContainerProvider.java b/containers/jetty-http2/src/main/java/org/glassfish/jersey/jetty/http2/JettyHttp2ContainerProvider.java index 5d8e6fd..01c61fc 100644 --- a/containers/jetty-http2/src/main/java/org/glassfish/jersey/jetty/http2/JettyHttp2ContainerProvider.java +++ b/containers/jetty-http2/src/main/java/org/glassfish/jersey/jetty/http2/JettyHttp2ContainerProvider.java
@@ -25,6 +25,8 @@ import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.core.Application; +import static org.glassfish.jersey.jetty.JettyHttpContainerProvider.HANDLER_NAME; + public final class JettyHttp2ContainerProvider implements ContainerProvider { @Override @@ -32,12 +34,8 @@ if (JdkVersion.getJdkVersion().getMajor() < 11) { throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED()); } - if (type != null - && ("org.eclipse.jetty.server.Handler".equalsIgnoreCase(type.getCanonicalName()) - || JettyHttpContainer.class == type) - ) { - return type.cast(new JettyHttpContainerProvider().createContainer(JettyHttpContainer.class, - application)); + if (type != null && (HANDLER_NAME.equalsIgnoreCase(type.getCanonicalName()) || JettyHttpContainer.class == type)) { + return type.cast(new JettyHttpContainerProvider().createContainer(JettyHttpContainer.class, application)); } return null; }