Skip to content

Commit

Permalink
MailHander should catch ServiceConfigurationError eclipse-ee4j#123
Browse files Browse the repository at this point in the history
Signed-off-by: jmehrens <[email protected]>
  • Loading branch information
jmehrens committed Jan 30, 2024
1 parent 624e2c4 commit c3f4b55
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@ public synchronized final void setSubjectFormatter(final Formatter format) {
*/
@Override
protected void reportError(String msg, Exception ex, int code) {
//For a this-escape, the error manager will be the default.
//This method is not protected from a this-escape.
//The error manager will be non-null in any case.
try {
if (msg != null) {
errorManager.error(Level.SEVERE.getName()
Expand Down Expand Up @@ -2186,6 +2187,11 @@ private void reportLinkageError(final Throwable le, final int code) {
if (idx == null || idx > MUTEX_LINKAGE) {
MUTEX.set(MUTEX_LINKAGE);
try {
//Per the API docs this is not how uncaught exception handler
//should be used. However, the throwable that we are receiving
//here is happening only when the JVM is shutting down.
//This will only execute on unpatched systems.
//See tickets listed in API docs above.
Thread.currentThread().getUncaughtExceptionHandler()
.uncaughtException(Thread.currentThread(), le);
} catch (RuntimeException | ServiceConfigurationError
Expand Down Expand Up @@ -4204,10 +4210,13 @@ private String descriptionFrom(Formatter f, Filter filter, Formatter name) {
*
* @param f the formatter.
* @return a class name that represents the given formatter.
* @throws NullPointerException if the parameter is null.
* @since JavaMail 1.4.5
*/
private String getClassId(final Formatter f) {
if (f == null) {
return "null";
}

if (f instanceof TailNameFormatter) {
return String.class.getName(); //Literal string.
} else {
Expand Down

0 comments on commit c3f4b55

Please sign in to comment.