This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 2a06bcc66c jakarta.websocket and jakarta.security cleanups 2a06bcc66c is described below commit 2a06bcc66c5ce45b49e1b8ae800b76079945a027 Author: remm <r...@apache.org> AuthorDate: Mon Mar 24 21:42:55 2025 +0100 jakarta.websocket and jakarta.security cleanups --- .../security/auth/message/AuthException.java | 5 +- java/jakarta/security/auth/message/AuthStatus.java | 2 +- java/jakarta/security/auth/message/ClientAuth.java | 8 +-- .../jakarta/security/auth/message/MessageInfo.java | 2 +- .../security/auth/message/MessagePolicy.java | 2 +- java/jakarta/security/auth/message/ServerAuth.java | 8 +-- .../message/callback/CallerPrincipalCallback.java | 2 +- .../auth/message/callback/CertStoreCallback.java | 2 +- .../message/callback/GroupPrincipalCallback.java | 2 +- .../callback/PasswordValidationCallback.java | 4 +- .../auth/message/callback/PrivateKeyCallback.java | 2 +- .../auth/message/callback/SecretKeyCallback.java | 2 +- .../auth/message/callback/TrustStoreCallback.java | 2 +- .../security/auth/message/config/AuthConfig.java | 2 +- .../auth/message/config/AuthConfigFactory.java | 2 +- .../auth/message/config/AuthConfigProvider.java | 2 +- .../auth/message/config/ClientAuthConfig.java | 2 +- .../auth/message/config/ClientAuthContext.java | 2 +- .../auth/message/config/RegistrationListener.java | 2 +- .../auth/message/config/ServerAuthConfig.java | 2 +- .../auth/message/config/ServerAuthContext.java | 2 +- .../auth/message/module/ClientAuthModule.java | 2 +- .../auth/message/module/ServerAuthModule.java | 2 +- java/jakarta/websocket/ClientEndpointConfig.java | 8 +-- java/jakarta/websocket/CloseReason.java | 61 +++++++--------------- java/jakarta/websocket/DecodeException.java | 2 + java/jakarta/websocket/DeploymentException.java | 3 ++ java/jakarta/websocket/EncodeException.java | 5 +- java/jakarta/websocket/Session.java | 6 +-- java/jakarta/websocket/SessionException.java | 3 ++ java/jakarta/websocket/server/PathParam.java | 2 +- .../websocket/server/ServerEndpointConfig.java | 8 +-- 32 files changed, 77 insertions(+), 84 deletions(-) diff --git a/java/jakarta/security/auth/message/AuthException.java b/java/jakarta/security/auth/message/AuthException.java index 1a2b652ec7..f5a71e44fc 100644 --- a/java/jakarta/security/auth/message/AuthException.java +++ b/java/jakarta/security/auth/message/AuthException.java @@ -1,4 +1,4 @@ -/** +/* * 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. @@ -16,9 +16,12 @@ */ package jakarta.security.auth.message; +import java.io.Serial; + import javax.security.auth.login.LoginException; public class AuthException extends LoginException { + @Serial private static final long serialVersionUID = -1156951780670243758L; public AuthException() { diff --git a/java/jakarta/security/auth/message/AuthStatus.java b/java/jakarta/security/auth/message/AuthStatus.java index 2e9c10de8a..ec009c80b4 100644 --- a/java/jakarta/security/auth/message/AuthStatus.java +++ b/java/jakarta/security/auth/message/AuthStatus.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/ClientAuth.java b/java/jakarta/security/auth/message/ClientAuth.java index c4bf93ed14..c907a05644 100644 --- a/java/jakarta/security/auth/message/ClientAuth.java +++ b/java/jakarta/security/auth/message/ClientAuth.java @@ -1,4 +1,4 @@ -/** +/* * 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. @@ -28,7 +28,7 @@ public interface ClientAuth { * * @return An AuthStatus instance that represents the result of the authentication * - * @throws AuthException If the a failure occurred in a manner that prevented the failure from being communicated + * @throws AuthException If a failure occurred in a manner that prevented the failure from being communicated * via messageInfo */ AuthStatus secureRequest(MessageInfo messageInfo, Subject clientSubject) throws AuthException; @@ -42,7 +42,7 @@ public interface ClientAuth { * * @return An AuthStatus instance that represents the result of the validation * - * @throws AuthException If the a failure occurred in a manner that prevented the failure from being communicated + * @throws AuthException If a failure occurred in a manner that prevented the failure from being communicated * via messageInfo */ default AuthStatus validateResponse(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) @@ -57,7 +57,7 @@ public interface ClientAuth { * @param messageInfo The associated request and response * @param subject The subject to clean * - * @throws AuthException If the a failure occurred + * @throws AuthException If a failure occurred */ default void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException { // NO-OP diff --git a/java/jakarta/security/auth/message/MessageInfo.java b/java/jakarta/security/auth/message/MessageInfo.java index eb2e10ee8d..4fd1e18f21 100644 --- a/java/jakarta/security/auth/message/MessageInfo.java +++ b/java/jakarta/security/auth/message/MessageInfo.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/MessagePolicy.java b/java/jakarta/security/auth/message/MessagePolicy.java index f58aaf5605..3237ab42d6 100644 --- a/java/jakarta/security/auth/message/MessagePolicy.java +++ b/java/jakarta/security/auth/message/MessagePolicy.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/ServerAuth.java b/java/jakarta/security/auth/message/ServerAuth.java index 84141ade22..a793aa983b 100644 --- a/java/jakarta/security/auth/message/ServerAuth.java +++ b/java/jakarta/security/auth/message/ServerAuth.java @@ -1,4 +1,4 @@ -/** +/* * 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. @@ -29,7 +29,7 @@ public interface ServerAuth { * * @return An AuthStatus instance that represents the result of the validation * - * @throws AuthException If the a failure occurred in a manner that prevented the failure from being communicated + * @throws AuthException If a failure occurred in a manner that prevented the failure from being communicated * via messageInfo */ AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) @@ -43,7 +43,7 @@ public interface ServerAuth { * * @return An AuthStatus instance that represents the result of the authentication * - * @throws AuthException If the a failure occurred in a manner that prevented the failure from being communicated + * @throws AuthException If a failure occurred in a manner that prevented the failure from being communicated * via messageInfo */ default AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException { @@ -57,7 +57,7 @@ public interface ServerAuth { * @param messageInfo The associated request and response * @param subject The subject to clean * - * @throws AuthException If the a failure occurred + * @throws AuthException If a failure occurred */ default void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException { // NO-OP diff --git a/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java b/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java index a7a5f8059c..c29fca9002 100644 --- a/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java +++ b/java/jakarta/security/auth/message/callback/CallerPrincipalCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/callback/CertStoreCallback.java b/java/jakarta/security/auth/message/callback/CertStoreCallback.java index 5a9455b525..d8aef96cb2 100644 --- a/java/jakarta/security/auth/message/callback/CertStoreCallback.java +++ b/java/jakarta/security/auth/message/callback/CertStoreCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java b/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java index ea5d2eb89f..f5b2e55ffe 100644 --- a/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java +++ b/java/jakarta/security/auth/message/callback/GroupPrincipalCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java b/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java index 9840375acd..37f957de6c 100644 --- a/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java +++ b/java/jakarta/security/auth/message/callback/PasswordValidationCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. @@ -22,7 +22,7 @@ import javax.security.auth.Subject; import javax.security.auth.callback.Callback; /** - * Callback that enables an authentication module to supply a user name and password (to a runtime?) and determine if + * Callback that enables an authentication module to supply a username and password (to a runtime?) and determine if * the result of validation. */ public class PasswordValidationCallback implements Callback { diff --git a/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java b/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java index dffcb0bed9..853ca02600 100644 --- a/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java +++ b/java/jakarta/security/auth/message/callback/PrivateKeyCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/callback/SecretKeyCallback.java b/java/jakarta/security/auth/message/callback/SecretKeyCallback.java index 95dd48851d..b3a02ad938 100644 --- a/java/jakarta/security/auth/message/callback/SecretKeyCallback.java +++ b/java/jakarta/security/auth/message/callback/SecretKeyCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/callback/TrustStoreCallback.java b/java/jakarta/security/auth/message/callback/TrustStoreCallback.java index 64ab85678f..9bafa9a26b 100644 --- a/java/jakarta/security/auth/message/callback/TrustStoreCallback.java +++ b/java/jakarta/security/auth/message/callback/TrustStoreCallback.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/AuthConfig.java b/java/jakarta/security/auth/message/config/AuthConfig.java index bd9feed380..099cccee8d 100644 --- a/java/jakarta/security/auth/message/config/AuthConfig.java +++ b/java/jakarta/security/auth/message/config/AuthConfig.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/AuthConfigFactory.java b/java/jakarta/security/auth/message/config/AuthConfigFactory.java index 2229eb66b8..e8f4938ad6 100644 --- a/java/jakarta/security/auth/message/config/AuthConfigFactory.java +++ b/java/jakarta/security/auth/message/config/AuthConfigFactory.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/AuthConfigProvider.java b/java/jakarta/security/auth/message/config/AuthConfigProvider.java index 3aa912dca6..66410a7e13 100644 --- a/java/jakarta/security/auth/message/config/AuthConfigProvider.java +++ b/java/jakarta/security/auth/message/config/AuthConfigProvider.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/ClientAuthConfig.java b/java/jakarta/security/auth/message/config/ClientAuthConfig.java index 2421bca5cb..f332f0fea6 100644 --- a/java/jakarta/security/auth/message/config/ClientAuthConfig.java +++ b/java/jakarta/security/auth/message/config/ClientAuthConfig.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/ClientAuthContext.java b/java/jakarta/security/auth/message/config/ClientAuthContext.java index 4321e8af52..53280c7822 100644 --- a/java/jakarta/security/auth/message/config/ClientAuthContext.java +++ b/java/jakarta/security/auth/message/config/ClientAuthContext.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/RegistrationListener.java b/java/jakarta/security/auth/message/config/RegistrationListener.java index 0d6f76d0e6..05bec1c163 100644 --- a/java/jakarta/security/auth/message/config/RegistrationListener.java +++ b/java/jakarta/security/auth/message/config/RegistrationListener.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/ServerAuthConfig.java b/java/jakarta/security/auth/message/config/ServerAuthConfig.java index 9477d7aa16..a8bc9c728c 100644 --- a/java/jakarta/security/auth/message/config/ServerAuthConfig.java +++ b/java/jakarta/security/auth/message/config/ServerAuthConfig.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/config/ServerAuthContext.java b/java/jakarta/security/auth/message/config/ServerAuthContext.java index 6f088fec1c..bbff396988 100644 --- a/java/jakarta/security/auth/message/config/ServerAuthContext.java +++ b/java/jakarta/security/auth/message/config/ServerAuthContext.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/module/ClientAuthModule.java b/java/jakarta/security/auth/message/module/ClientAuthModule.java index b7fa96a006..b0569a462c 100644 --- a/java/jakarta/security/auth/message/module/ClientAuthModule.java +++ b/java/jakarta/security/auth/message/module/ClientAuthModule.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/security/auth/message/module/ServerAuthModule.java b/java/jakarta/security/auth/message/module/ServerAuthModule.java index 8c658730ab..3518bea61d 100644 --- a/java/jakarta/security/auth/message/module/ServerAuthModule.java +++ b/java/jakarta/security/auth/message/module/ServerAuthModule.java @@ -1,4 +1,4 @@ -/** +/* * 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. diff --git a/java/jakarta/websocket/ClientEndpointConfig.java b/java/jakarta/websocket/ClientEndpointConfig.java index ce3caba85e..2af1f41575 100644 --- a/java/jakarta/websocket/ClientEndpointConfig.java +++ b/java/jakarta/websocket/ClientEndpointConfig.java @@ -71,7 +71,7 @@ public interface ClientEndpointConfig extends EndpointConfig { public Builder preferredSubprotocols(List<String> preferredSubprotocols) { - if (preferredSubprotocols == null || preferredSubprotocols.size() == 0) { + if (preferredSubprotocols == null || preferredSubprotocols.isEmpty()) { this.preferredSubprotocols = Collections.emptyList(); } else { this.preferredSubprotocols = Collections.unmodifiableList(preferredSubprotocols); @@ -81,7 +81,7 @@ public interface ClientEndpointConfig extends EndpointConfig { public Builder extensions(List<Extension> extensions) { - if (extensions == null || extensions.size() == 0) { + if (extensions == null || extensions.isEmpty()) { this.extensions = Collections.emptyList(); } else { this.extensions = Collections.unmodifiableList(extensions); @@ -91,7 +91,7 @@ public interface ClientEndpointConfig extends EndpointConfig { public Builder encoders(List<Class<? extends Encoder>> encoders) { - if (encoders == null || encoders.size() == 0) { + if (encoders == null || encoders.isEmpty()) { this.encoders = Collections.emptyList(); } else { this.encoders = Collections.unmodifiableList(encoders); @@ -101,7 +101,7 @@ public interface ClientEndpointConfig extends EndpointConfig { public Builder decoders(List<Class<? extends Decoder>> decoders) { - if (decoders == null || decoders.size() == 0) { + if (decoders == null || decoders.isEmpty()) { this.decoders = Collections.emptyList(); } else { this.decoders = Collections.unmodifiableList(decoders); diff --git a/java/jakarta/websocket/CloseReason.java b/java/jakarta/websocket/CloseReason.java index da33c5f8cb..b7aef11305 100644 --- a/java/jakarta/websocket/CloseReason.java +++ b/java/jakarta/websocket/CloseReason.java @@ -61,7 +61,7 @@ public class CloseReason { TRY_AGAIN_LATER(1013), TLS_HANDSHAKE_FAILURE(1015); - private int code; + private final int code; CloseCodes(int code) { this.code = code; @@ -69,47 +69,26 @@ public class CloseReason { public static CloseCode getCloseCode(final int code) { if (code > 2999 && code < 5000) { - return new CloseCode() { - @Override - public int getCode() { - return code; - } - }; - } - switch (code) { - case 1000: - return NORMAL_CLOSURE; - case 1001: - return GOING_AWAY; - case 1002: - return PROTOCOL_ERROR; - case 1003: - return CANNOT_ACCEPT; - case 1004: - return RESERVED; - case 1005: - return NO_STATUS_CODE; - case 1006: - return CLOSED_ABNORMALLY; - case 1007: - return NOT_CONSISTENT; - case 1008: - return VIOLATED_POLICY; - case 1009: - return TOO_BIG; - case 1010: - return NO_EXTENSION; - case 1011: - return UNEXPECTED_CONDITION; - case 1012: - return SERVICE_RESTART; - case 1013: - return TRY_AGAIN_LATER; - case 1015: - return TLS_HANDSHAKE_FAILURE; - default: - throw new IllegalArgumentException("Invalid close code: [" + code + "]"); + return () -> code; } + return switch (code) { + case 1000 -> NORMAL_CLOSURE; + case 1001 -> GOING_AWAY; + case 1002 -> PROTOCOL_ERROR; + case 1003 -> CANNOT_ACCEPT; + case 1004 -> RESERVED; + case 1005 -> NO_STATUS_CODE; + case 1006 -> CLOSED_ABNORMALLY; + case 1007 -> NOT_CONSISTENT; + case 1008 -> VIOLATED_POLICY; + case 1009 -> TOO_BIG; + case 1010 -> NO_EXTENSION; + case 1011 -> UNEXPECTED_CONDITION; + case 1012 -> SERVICE_RESTART; + case 1013 -> TRY_AGAIN_LATER; + case 1015 -> TLS_HANDSHAKE_FAILURE; + default -> throw new IllegalArgumentException("Invalid close code: [" + code + "]"); + }; } @Override diff --git a/java/jakarta/websocket/DecodeException.java b/java/jakarta/websocket/DecodeException.java index 1fc3159c23..e6a9279094 100644 --- a/java/jakarta/websocket/DecodeException.java +++ b/java/jakarta/websocket/DecodeException.java @@ -16,10 +16,12 @@ */ package jakarta.websocket; +import java.io.Serial; import java.nio.ByteBuffer; public class DecodeException extends Exception { + @Serial private static final long serialVersionUID = 1L; private ByteBuffer bb; diff --git a/java/jakarta/websocket/DeploymentException.java b/java/jakarta/websocket/DeploymentException.java index 75bb0275ed..d12f62680b 100644 --- a/java/jakarta/websocket/DeploymentException.java +++ b/java/jakarta/websocket/DeploymentException.java @@ -16,8 +16,11 @@ */ package jakarta.websocket; +import java.io.Serial; + public class DeploymentException extends Exception { + @Serial private static final long serialVersionUID = 1L; public DeploymentException(String message) { diff --git a/java/jakarta/websocket/EncodeException.java b/java/jakarta/websocket/EncodeException.java index 21e8598038..406b0ffee1 100644 --- a/java/jakarta/websocket/EncodeException.java +++ b/java/jakarta/websocket/EncodeException.java @@ -16,11 +16,14 @@ */ package jakarta.websocket; +import java.io.Serial; + public class EncodeException extends Exception { + @Serial private static final long serialVersionUID = 1L; - private Object object; + private final Object object; public EncodeException(Object object, String message) { super(message); diff --git a/java/jakarta/websocket/Session.java b/java/jakarta/websocket/Session.java index 06e25a57fb..21e20ea086 100644 --- a/java/jakarta/websocket/Session.java +++ b/java/jakarta/websocket/Session.java @@ -40,7 +40,7 @@ public interface Session extends Closeable { * {@link #addMessageHandler(Class, jakarta.websocket.MessageHandler.Partial)} or * {@link #addMessageHandler(Class, jakarta.websocket.MessageHandler.Whole)}. * - * @param handler The message handler for a incoming message + * @param handler The message handler for an incoming message * * @throws IllegalStateException If a message handler has already been registered for the associated message type */ @@ -160,7 +160,7 @@ public interface Session extends Closeable { * * @param <T> The type of message that the given handler is intended for * @param clazz The Class that implements T - * @param handler The message handler for a incoming message + * @param handler The message handler for an incoming message * * @throws IllegalStateException If a message handler has already been registered for the associated message type * @@ -174,7 +174,7 @@ public interface Session extends Closeable { * * @param <T> The type of message that the given handler is intended for * @param clazz The Class that implements T - * @param handler The message handler for a incoming message + * @param handler The message handler for an incoming message * * @throws IllegalStateException If a message handler has already been registered for the associated message type * diff --git a/java/jakarta/websocket/SessionException.java b/java/jakarta/websocket/SessionException.java index b3eafed099..d1d0f9908c 100644 --- a/java/jakarta/websocket/SessionException.java +++ b/java/jakarta/websocket/SessionException.java @@ -16,8 +16,11 @@ */ package jakarta.websocket; +import java.io.Serial; + public class SessionException extends Exception { + @Serial private static final long serialVersionUID = 1L; private final Session session; diff --git a/java/jakarta/websocket/server/PathParam.java b/java/jakarta/websocket/server/PathParam.java index e61294b428..22293b3dda 100644 --- a/java/jakarta/websocket/server/PathParam.java +++ b/java/jakarta/websocket/server/PathParam.java @@ -22,7 +22,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Used to annotate method parameters on POJO endpoints the the {@link ServerEndpoint} has been defined with a + * Used to annotate method parameters on POJO endpoints that the {@link ServerEndpoint} has been defined with a * {@link ServerEndpoint#value()} that uses a URI template. */ @Retention(RetentionPolicy.RUNTIME) diff --git a/java/jakarta/websocket/server/ServerEndpointConfig.java b/java/jakarta/websocket/server/ServerEndpointConfig.java index 4f21c42c51..8c0abe3f13 100644 --- a/java/jakarta/websocket/server/ServerEndpointConfig.java +++ b/java/jakarta/websocket/server/ServerEndpointConfig.java @@ -90,7 +90,7 @@ public interface ServerEndpointConfig extends EndpointConfig { public Builder encoders(List<Class<? extends Encoder>> encoders) { - if (encoders == null || encoders.size() == 0) { + if (encoders == null || encoders.isEmpty()) { this.encoders = Collections.emptyList(); } else { this.encoders = Collections.unmodifiableList(encoders); @@ -100,7 +100,7 @@ public interface ServerEndpointConfig extends EndpointConfig { public Builder decoders(List<Class<? extends Decoder>> decoders) { - if (decoders == null || decoders.size() == 0) { + if (decoders == null || decoders.isEmpty()) { this.decoders = Collections.emptyList(); } else { this.decoders = Collections.unmodifiableList(decoders); @@ -110,7 +110,7 @@ public interface ServerEndpointConfig extends EndpointConfig { public Builder subprotocols(List<String> subprotocols) { - if (subprotocols == null || subprotocols.size() == 0) { + if (subprotocols == null || subprotocols.isEmpty()) { this.subprotocols = Collections.emptyList(); } else { this.subprotocols = Collections.unmodifiableList(subprotocols); @@ -120,7 +120,7 @@ public interface ServerEndpointConfig extends EndpointConfig { public Builder extensions(List<Extension> extensions) { - if (extensions == null || extensions.size() == 0) { + if (extensions == null || extensions.isEmpty()) { this.extensions = Collections.emptyList(); } else { this.extensions = Collections.unmodifiableList(extensions); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org