Skip to content

Remove punctuation in Exception messages #2603

Closed
@jxblum

Description

@jxblum

Many Exception messages contain exclamation marks (!) at the end of the Exception message, for example:

"Object must not be null!"

While this alerts the user to an immediate problem in his/her code, it could be construed as abrasive.

Additionally, using any form of punctuation in Exception messages is not conducive for chaining. Generally, in Java Exception/Error (Throwable) chaining, the messages from the underlying Exceptions (causes) are chained together with the outer, wrapping Exception, for example:

java.lang.IllegalArgumentException: "Message from the wrapping IllegalArgumentException followed by; Message of the caused by Exception"
  at ...
caused by: java.lang.IllegalStateException: Message of the caused by Exception
  at ...

That is, the Exception messages from the chain are appended and separated by the ;.

If the messages from the wrapping Exceptions in the Exception chain contain punctuation, then it can lead to confusing text:

java.lang.IllegalArgumentException: "Object must not be null!; Message of the caused by Exception"
  at...
caused by: java.lang.IllegalStateException: Message of the caused by Exception
  at ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions