diff --git a/helper-dependencies/pom.xml b/helper-dependencies/pom.xml index 5eaf522..bec6ba5 100644 --- a/helper-dependencies/pom.xml +++ b/helper-dependencies/pom.xml @@ -17,7 +17,6 @@ 3.6.0 - 3.9 1.3.3 11.22.9 diff --git a/helper-javafx/src/main/java/com/github/mrzhqiang/helper/javafx/ui/Dialogs.java b/helper-javafx/src/main/java/com/github/mrzhqiang/helper/javafx/ui/Dialogs.java index 3c282ba..82c33f9 100644 --- a/helper-javafx/src/main/java/com/github/mrzhqiang/helper/javafx/ui/Dialogs.java +++ b/helper-javafx/src/main/java/com/github/mrzhqiang/helper/javafx/ui/Dialogs.java @@ -1,6 +1,6 @@ package com.github.mrzhqiang.helper.javafx.ui; -import com.github.mrzhqiang.helper.StackTraces; +import com.github.mrzhqiang.helper.Exceptions; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import javafx.scene.control.Alert; @@ -62,11 +62,11 @@ public static Alert warn(String message, @Nullable String content) { return alert; } - public static Alert error(Throwable error) { + public static Alert error(Exception error) { return error(error.toString(), error); } - public static Alert error(@Nullable String message, Throwable cause) { + public static Alert error(@Nullable String message, Exception cause) { Preconditions.checkNotNull(cause, "cause == null"); String errorMsg = Strings.isNullOrEmpty(message) ? DEFAULT_ERROR_MESSAGE : message; @@ -75,7 +75,7 @@ public static Alert error(@Nullable String message, Throwable cause) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("错误"); alert.setHeaderText(errorMsg); - alert.setContentText(StackTraces.of(cause)); + alert.setContentText(Exceptions.ofTrace(cause)); return alert; } diff --git a/helper-third/pom.xml b/helper-third/pom.xml index c4a86d4..6006157 100644 --- a/helper-third/pom.xml +++ b/helper-third/pom.xml @@ -19,7 +19,6 @@ helper-third-api helper-third-core - helper-third-core diff --git a/helper/src/test/java/com/github/mrzhqiang/helper/ExceptionsTest.java b/helper/src/test/java/com/github/mrzhqiang/helper/ExceptionsTest.java new file mode 100644 index 0000000..d3083b6 --- /dev/null +++ b/helper/src/test/java/com/github/mrzhqiang/helper/ExceptionsTest.java @@ -0,0 +1,14 @@ +package com.github.mrzhqiang.helper; + +import static org.junit.Assert.assertNotEquals; +import org.junit.Test; + +public class ExceptionsTest { + + @Test + public void of() { + String runtime = Exceptions.ofTrace(new RuntimeException("runtime")); + String nullPointer = Exceptions.ofTrace(new NullPointerException("null")); + assertNotEquals(runtime, nullPointer); + } +} diff --git a/helper/src/test/java/com/github/mrzhqiang/helper/StackTracesTest.java b/helper/src/test/java/com/github/mrzhqiang/helper/StackTracesTest.java index edc5d3b..2fc236f 100644 --- a/helper/src/test/java/com/github/mrzhqiang/helper/StackTracesTest.java +++ b/helper/src/test/java/com/github/mrzhqiang/helper/StackTracesTest.java @@ -1,8 +1,7 @@ package com.github.mrzhqiang.helper; -import org.junit.Test; - import static org.junit.Assert.assertNotEquals; +import org.junit.Test; public class StackTracesTest { @@ -12,11 +11,4 @@ public void ofCurrent() { String secondTrace = StackTraces.ofCurrent(); assertNotEquals(firstTrace, secondTrace); } - - @Test - public void of() { - String runtime = StackTraces.of(new RuntimeException("runtime")); - String nullPointer = StackTraces.of(new NullPointerException("null")); - assertNotEquals(runtime, nullPointer); - } -} \ No newline at end of file +}