Class EmptyLoginException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyLoginException
All Implemented Interfaces:
Serializable

public class EmptyLoginException extends Exception
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 User constructor or setLogin() with null, 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 Details

    • EmptyLoginException

      public EmptyLoginException(String message)
      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 by Throwable.getMessage()
    • EmptyLoginException

      public EmptyLoginException(String message, Throwable cause)
      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 message
      cause - the root cause of this exception
      Since:
      1.2