Skip to content

Commit

Permalink
v1.0.2 fix ExitProcessOnUncaught from Exception to Error
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrandes committed Sep 15, 2020
1 parent 99891f3 commit 62ba320
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Manage SSH Tunnels made easy. Open Source Java project under Apache License v2.0

### Current Stable Version is [1.0.1](https://github.com/ggrandes/jentunnel/releases)
### Current Stable Version is [1.0.2](https://github.com/ggrandes/jentunnel/releases)

---

Expand Down
2 changes: 1 addition & 1 deletion jentunnel-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.javastack</groupId>
<artifactId>jentunnel</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jentunnel-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.javastack</groupId>
<artifactId>jentunnel</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,32 @@
import java.util.Map;
import java.util.Map.Entry;

public class ExitProcessOnUncaughtException implements UncaughtExceptionHandler {
public class ExitProcessOnUncaughtError implements UncaughtExceptionHandler {
public static void register() {
Thread.setDefaultUncaughtExceptionHandler(new ExitProcessOnUncaughtException());
Thread.setDefaultUncaughtExceptionHandler(new ExitProcessOnUncaughtError());
}

private ExitProcessOnUncaughtException() {
private ExitProcessOnUncaughtError() {
}

@Override
public void uncaughtException(Thread t, Throwable e) {
final boolean isError = (e instanceof Error);
try {
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
System.out.println("Uncaught exception caught" + " in thread: " + t);
System.out.flush();
System.out.println();
System.err.println(writer.getBuffer().toString());
System.err.flush();
printFullCoreDump();
System.out.println(writer.getBuffer().toString());
System.out.flush();
if (isError) {
printFullCoreDump();
}
} finally {
Runtime.getRuntime().halt(1);
if (isError) {
Runtime.getRuntime().halt(1);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void main(String[] args) throws Throwable {
System.out.println("SystemTray is not supported");
}
// Ordered shutdown on Uncaught Exceptions
ExitProcessOnUncaughtException.register();
ExitProcessOnUncaughtError.register();
// Enable window decorations
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>org.javastack</groupId>
<artifactId>jentunnel</artifactId>
<packaging>pom</packaging>
<version>1.0.1</version>
<version>1.0.2</version>
<description>Badges for Maven Central</description>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down

0 comments on commit 62ba320

Please sign in to comment.