diff --git a/src/main/java/com/chat/yourway/controller/rest/ChangePasswordController.java b/src/main/java/com/chat/yourway/controller/rest/ChangePasswordController.java index dbf1121..14f5e66 100644 --- a/src/main/java/com/chat/yourway/controller/rest/ChangePasswordController.java +++ b/src/main/java/com/chat/yourway/controller/rest/ChangePasswordController.java @@ -28,8 +28,7 @@ public class ChangePasswordController { private static final String PASSWORD_EMAIL = "/password/email"; private static final String PASSWORD_RESTORE = "/password/restore"; - @Operation(summary = "Change to new password", - responses = { + @Operation(summary = "Change to new password", responses = { @ApiResponse(responseCode = "200", description = SUCCESSFULLY_CHANGING_PASSWORD, content = @Content), @ApiResponse(responseCode = "400", description = INVALID_OLD_PASSWORD, diff --git a/src/main/java/com/chat/yourway/exception/ContactAlreadySubscribedToTopicException.java b/src/main/java/com/chat/yourway/exception/ContactAlreadySubscribedToTopicException.java index 0c8356f..7ee9101 100644 --- a/src/main/java/com/chat/yourway/exception/ContactAlreadySubscribedToTopicException.java +++ b/src/main/java/com/chat/yourway/exception/ContactAlreadySubscribedToTopicException.java @@ -1,8 +1,9 @@ package com.chat.yourway.exception; -public class ContactAlreadySubscribedToTopicException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; +public class ContactAlreadySubscribedToTopicException extends BaseRuntimeException { public ContactAlreadySubscribedToTopicException(String message) { super(message); } -} +} \ No newline at end of file diff --git a/src/main/java/com/chat/yourway/exception/ContactEmailNotExist.java b/src/main/java/com/chat/yourway/exception/ContactEmailNotExist.java index 108468b..8c58abe 100644 --- a/src/main/java/com/chat/yourway/exception/ContactEmailNotExist.java +++ b/src/main/java/com/chat/yourway/exception/ContactEmailNotExist.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class ContactEmailNotExist extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class ContactEmailNotExist extends BaseRuntimeException { public ContactEmailNotExist(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/ContactNotFoundException.java b/src/main/java/com/chat/yourway/exception/ContactNotFoundException.java index 1d5000b..afc99dc 100644 --- a/src/main/java/com/chat/yourway/exception/ContactNotFoundException.java +++ b/src/main/java/com/chat/yourway/exception/ContactNotFoundException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class ContactNotFoundException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class ContactNotFoundException extends BaseRuntimeException { public ContactNotFoundException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/EmailSendingException.java b/src/main/java/com/chat/yourway/exception/EmailSendingException.java index bfea901..b6ad091 100644 --- a/src/main/java/com/chat/yourway/exception/EmailSendingException.java +++ b/src/main/java/com/chat/yourway/exception/EmailSendingException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class EmailSendingException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class EmailSendingException extends BaseRuntimeException { public EmailSendingException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/EmailTokenNotFoundException.java b/src/main/java/com/chat/yourway/exception/EmailTokenNotFoundException.java index 3e08f2c..9ce0bf3 100644 --- a/src/main/java/com/chat/yourway/exception/EmailTokenNotFoundException.java +++ b/src/main/java/com/chat/yourway/exception/EmailTokenNotFoundException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class EmailTokenNotFoundException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class EmailTokenNotFoundException extends BaseRuntimeException { public EmailTokenNotFoundException() { super("Current token does not exist"); } diff --git a/src/main/java/com/chat/yourway/exception/InvalidCredentialsException.java b/src/main/java/com/chat/yourway/exception/InvalidCredentialsException.java index ac480bd..4a97f10 100644 --- a/src/main/java/com/chat/yourway/exception/InvalidCredentialsException.java +++ b/src/main/java/com/chat/yourway/exception/InvalidCredentialsException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class InvalidCredentialsException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class InvalidCredentialsException extends BaseRuntimeException { public InvalidCredentialsException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/InvalidTokenException.java b/src/main/java/com/chat/yourway/exception/InvalidTokenException.java index 7d3036c..d216833 100644 --- a/src/main/java/com/chat/yourway/exception/InvalidTokenException.java +++ b/src/main/java/com/chat/yourway/exception/InvalidTokenException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class InvalidTokenException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class InvalidTokenException extends BaseRuntimeException { public InvalidTokenException(String message) { super(message); diff --git a/src/main/java/com/chat/yourway/exception/MessageHasAlreadyReportedException.java b/src/main/java/com/chat/yourway/exception/MessageHasAlreadyReportedException.java index 447a132..a7332f2 100644 --- a/src/main/java/com/chat/yourway/exception/MessageHasAlreadyReportedException.java +++ b/src/main/java/com/chat/yourway/exception/MessageHasAlreadyReportedException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class MessageHasAlreadyReportedException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class MessageHasAlreadyReportedException extends BaseRuntimeException { public MessageHasAlreadyReportedException() { super("Message has already reported."); } diff --git a/src/main/java/com/chat/yourway/exception/MessageNotFoundException.java b/src/main/java/com/chat/yourway/exception/MessageNotFoundException.java index 5eae0cc..220c6f3 100644 --- a/src/main/java/com/chat/yourway/exception/MessageNotFoundException.java +++ b/src/main/java/com/chat/yourway/exception/MessageNotFoundException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class MessageNotFoundException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class MessageNotFoundException extends BaseRuntimeException { public MessageNotFoundException() { super("Message is not found."); } diff --git a/src/main/java/com/chat/yourway/exception/MessagePermissionDeniedException.java b/src/main/java/com/chat/yourway/exception/MessagePermissionDeniedException.java index de3b5b0..2e8651d 100644 --- a/src/main/java/com/chat/yourway/exception/MessagePermissionDeniedException.java +++ b/src/main/java/com/chat/yourway/exception/MessagePermissionDeniedException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class MessagePermissionDeniedException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class MessagePermissionDeniedException extends BaseRuntimeException { public MessagePermissionDeniedException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/NotSubscribedTopicException.java b/src/main/java/com/chat/yourway/exception/NotSubscribedTopicException.java index 8eb70b7..9e534fb 100644 --- a/src/main/java/com/chat/yourway/exception/NotSubscribedTopicException.java +++ b/src/main/java/com/chat/yourway/exception/NotSubscribedTopicException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class NotSubscribedTopicException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class NotSubscribedTopicException extends BaseRuntimeException { public NotSubscribedTopicException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/OwnerCantUnsubscribedException.java b/src/main/java/com/chat/yourway/exception/OwnerCantUnsubscribedException.java index 4151390..9647229 100644 --- a/src/main/java/com/chat/yourway/exception/OwnerCantUnsubscribedException.java +++ b/src/main/java/com/chat/yourway/exception/OwnerCantUnsubscribedException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class OwnerCantUnsubscribedException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class OwnerCantUnsubscribedException extends BaseRuntimeException { public OwnerCantUnsubscribedException(String message) { super(message); diff --git a/src/main/java/com/chat/yourway/exception/PasswordsAreNotEqualException.java b/src/main/java/com/chat/yourway/exception/PasswordsAreNotEqualException.java index 508b5e7..6350900 100644 --- a/src/main/java/com/chat/yourway/exception/PasswordsAreNotEqualException.java +++ b/src/main/java/com/chat/yourway/exception/PasswordsAreNotEqualException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class PasswordsAreNotEqualException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class PasswordsAreNotEqualException extends BaseRuntimeException { public PasswordsAreNotEqualException() { super("Passwords are not equal."); } diff --git a/src/main/java/com/chat/yourway/exception/TokenNotFoundException.java b/src/main/java/com/chat/yourway/exception/TokenNotFoundException.java index 399e9cd..d5f8be0 100644 --- a/src/main/java/com/chat/yourway/exception/TokenNotFoundException.java +++ b/src/main/java/com/chat/yourway/exception/TokenNotFoundException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class TokenNotFoundException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class TokenNotFoundException extends BaseRuntimeException { public TokenNotFoundException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/TopicAccessException.java b/src/main/java/com/chat/yourway/exception/TopicAccessException.java index ce2df05..eef075e 100644 --- a/src/main/java/com/chat/yourway/exception/TopicAccessException.java +++ b/src/main/java/com/chat/yourway/exception/TopicAccessException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class TopicAccessException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class TopicAccessException extends BaseRuntimeException { public TopicAccessException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/TopicNotFoundException.java b/src/main/java/com/chat/yourway/exception/TopicNotFoundException.java index f9a82ac..ff86058 100644 --- a/src/main/java/com/chat/yourway/exception/TopicNotFoundException.java +++ b/src/main/java/com/chat/yourway/exception/TopicNotFoundException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class TopicNotFoundException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class TopicNotFoundException extends BaseRuntimeException { public TopicNotFoundException(String message) { super(message); } diff --git a/src/main/java/com/chat/yourway/exception/TopicSubscriberNotFoundException.java b/src/main/java/com/chat/yourway/exception/TopicSubscriberNotFoundException.java index f519a86..de4028d 100644 --- a/src/main/java/com/chat/yourway/exception/TopicSubscriberNotFoundException.java +++ b/src/main/java/com/chat/yourway/exception/TopicSubscriberNotFoundException.java @@ -1,6 +1,8 @@ package com.chat.yourway.exception; -public class TopicSubscriberNotFoundException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class TopicSubscriberNotFoundException extends BaseRuntimeException { public TopicSubscriberNotFoundException(String message) { super(message); diff --git a/src/main/java/com/chat/yourway/exception/ValueNotUniqException.java b/src/main/java/com/chat/yourway/exception/ValueNotUniqException.java index b61c20e..9a37007 100644 --- a/src/main/java/com/chat/yourway/exception/ValueNotUniqException.java +++ b/src/main/java/com/chat/yourway/exception/ValueNotUniqException.java @@ -1,7 +1,9 @@ package com.chat.yourway.exception; -public class ValueNotUniqException extends RuntimeException { +import com.chat.yourway.exception.handler.BaseRuntimeException; + +public class ValueNotUniqException extends BaseRuntimeException { public ValueNotUniqException(String message) { super(message); } -} +} \ No newline at end of file diff --git a/src/main/java/com/chat/yourway/exception/handler/BaseRuntimeException.java b/src/main/java/com/chat/yourway/exception/handler/BaseRuntimeException.java new file mode 100644 index 0000000..2d2f89a --- /dev/null +++ b/src/main/java/com/chat/yourway/exception/handler/BaseRuntimeException.java @@ -0,0 +1,23 @@ +package com.chat.yourway.exception.handler; + +public class BaseRuntimeException extends RuntimeException { + public BaseRuntimeException() { + super(); + } + + public BaseRuntimeException(Throwable cause) { + super(cause); + } + + public BaseRuntimeException(String message) { + super(message); + } + + public BaseRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + protected BaseRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/src/main/java/com/chat/yourway/listener/StompSubscriptionListener.java b/src/main/java/com/chat/yourway/listener/StompSubscriptionListener.java index 5267e49..bb49192 100644 --- a/src/main/java/com/chat/yourway/listener/StompSubscriptionListener.java +++ b/src/main/java/com/chat/yourway/listener/StompSubscriptionListener.java @@ -45,7 +45,6 @@ public void handleWebSocketUnsubscribeListener(SessionUnsubscribeEvent event) { String email = getEmail(event); if (isTopicDestination(destination)) { - UUID topicId = getTopicId(event); contactOnlineService.setUserOnline(email); log.info("Contact [{}] unsubscribe from [{}]", email, destination); }