-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-arch2' of github.com:JabRef/jabref into fix-arch2
- Loading branch information
Showing
10 changed files
with
63 additions
and
50 deletions.
There are no files selected for viewing
28 changes: 0 additions & 28 deletions
28
src/main/java/org/jabref/gui/FallbackExceptionHandler.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/org/jabref/logic/util/FallbackExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jabref.logic.util; | ||
|
||
import java.util.function.BiConsumer; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Catch and log any unhandled exceptions. | ||
*/ | ||
public class FallbackExceptionHandler implements Thread.UncaughtExceptionHandler { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(FallbackExceptionHandler.class); | ||
|
||
private final BiConsumer<Throwable, Thread> onException; | ||
|
||
public FallbackExceptionHandler(BiConsumer<Throwable, Thread> onException) { | ||
this.onException = onException; | ||
} | ||
|
||
public FallbackExceptionHandler() { | ||
this(null); | ||
} | ||
|
||
public static void installExceptionHandler(BiConsumer<Throwable, Thread> onException) { | ||
Thread.setDefaultUncaughtExceptionHandler(new FallbackExceptionHandler(onException)); | ||
} | ||
|
||
@Override | ||
public void uncaughtException(Thread thread, Throwable exception) { | ||
LOGGER.error("Uncaught exception occurred in {}", thread, exception); | ||
if (this.onException != null) { | ||
this.onException.accept(exception, thread); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters