You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/24 12:42:24 UTC
[commons-lang] branch master updated: Clean ups.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new a14b289 Clean ups.
a14b289 is described below
commit a14b28923e3a6d76732de072a774c6eed1f9ce61
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jun 24 08:42:16 2020 -0400
Clean ups.
- Fix Javadoc
- Simplify error message
- Rmove on layer of API call.
---
.../commons/lang3/exception/ExceptionUtils.java | 28 ++++++++++++----------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
index 5b48b0e..8c387a9 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -24,12 +24,12 @@ import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.StringTokenizer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
/**
* <p>Provides utilities for manipulating and examining
@@ -624,20 +624,21 @@ public class ExceptionUtils {
* that don't have nested causes.</p>
*
* @param throwable the throwable to output, may be null
- * @param stream the stream to output to, may not be null
- * @throws IllegalArgumentException if the stream is {@code null}
+ * @param printStream the stream to output to, may not be null
+ * @throws NullPointerException if the printStream is {@code null}
* @since 2.0
*/
- public static void printRootCauseStackTrace(final Throwable throwable, final PrintStream stream) {
+ @SuppressWarnings("resource")
+ public static void printRootCauseStackTrace(final Throwable throwable, final PrintStream printStream) {
if (throwable == null) {
return;
}
- Validate.notNull(stream, "The PrintStream must not be null");
+ Objects.requireNonNull(printStream, "printStream");
final String[] trace = getRootCauseStackTrace(throwable);
for (final String element : trace) {
- stream.println(element);
+ printStream.println(element);
}
- stream.flush();
+ printStream.flush();
}
/**
@@ -655,20 +656,21 @@ public class ExceptionUtils {
* that don't have nested causes.</p>
*
* @param throwable the throwable to output, may be null
- * @param writer the writer to output to, may not be null
- * @throws IllegalArgumentException if the writer is {@code null}
+ * @param printWriter the writer to output to, may not be null
+ * @throws NullPointerException if the printWriter is {@code null}
* @since 2.0
*/
- public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter writer) {
+ @SuppressWarnings("resource")
+ public static void printRootCauseStackTrace(final Throwable throwable, final PrintWriter printWriter) {
if (throwable == null) {
return;
}
- Validate.notNull(writer, "The PrintWriter must not be null");
+ Objects.requireNonNull(printWriter, "printWriter");
final String[] trace = getRootCauseStackTrace(throwable);
for (final String element : trace) {
- writer.println(element);
+ printWriter.println(element);
}
- writer.flush();
+ printWriter.flush();
}
/**