Class EmptyLoginException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyLoginException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to create, update, or authenticate
a user with a
null, empty, or whitespace-only login.
The login field in the base User entity
(and all its subclasses — Customer, Admin, etc.) is a mandatory,
unique identifier used for authentication. Allowing empty logins would break
security, uniqueness constraints, and the entire authentication system.
Common scenarios that trigger this exception:
- User registration form submitted without entering a login/username
- Calling the
Userconstructor orsetLogin()withnull, empty string, or only whitespace - Admin manually creating a user account with missing login
- Data import/migration process containing records with blank login values
This is a checked exception, requiring explicit handling or declaration. It represents an expected, recoverable validation error — not a programming bug.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEmptyLoginException(String message) Constructs a new empty-login exception with the specified detail message.EmptyLoginException(String message, Throwable cause) Constructs a new empty-login exception with the specified detail message and cause. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
EmptyLoginException
Constructs a new empty-login exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Login cannot be null or empty") Saved for later retrieval byThrowable.getMessage()
-
EmptyLoginException
Constructs a new empty-login exception with the specified detail message and cause.Useful when wrapping lower-level errors (e.g., database unique constraint violation during login assignment, validation framework errors, etc.).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-