Class EmptyContentException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.goldenleaf.shop.exception.EmptyContentException
- All Implemented Interfaces:
Serializable
Checked exception thrown when an attempt is made to create or save a review
(or any other user-generated textual content) with an empty or missing text body.
The content of a Review is a mandatory field.
This exception guarantees that only meaningful reviews are persisted,
preventing spam, accidental submissions, or incomplete data.
Typical scenarios that trigger this exception:
- User submits a review form without typing any text
- Calling
Customer.makeReview(com.goldenleaf.shop.model.Product, java.lang.String, int)withnull, empty string or whitespace-only content - Validation failure during batch import of reviews/comments
- Business rule enforcement – empty reviews are not allowed
Being a checked exception, the caller must explicitly handle it
or declare it in the throws clause. This is appropriate for expected,
recoverable validation errors in normal application flow.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEmptyContentException(String message) Constructs a new empty-content exception with the specified detail message.EmptyContentException(String message, Throwable cause) Constructs a new empty-content 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
-
EmptyContentException
Constructs a new empty-content exception with the specified detail message.- Parameters:
message- the detail message (e.g. "Review content cannot be null or empty") Saved for later retrieval byThrowable.getMessage()
-
EmptyContentException
Constructs a new empty-content exception with the specified detail message and cause.Useful when this validation exception wraps a lower-level technical exception (e.g., constraint violation, parsing error, etc.).
- Parameters:
message- the detail messagecause- the root cause of this exception- Since:
- 1.2
-