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 02eac5e1a Javadoc
02eac5e1a is described below

commit 02eac5e1a5ea9229111ec37b62ba98437fe3bf8f
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jan 6 11:11:03 2024 -0500

    Javadoc
---
 .../commons/lang3/exception/ExceptionUtils.java    | 34 +++++++++++++++-------
 1 file changed, 23 insertions(+), 11 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 9ea769a62..cd355afca 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -72,21 +72,26 @@ public class ExceptionUtils {
     static final String WRAPPED_MARKER = " [wrapped] ";
 
     /**
-     * Use to throws a checked exception without adding the exception to the 
throws
+     * Throws the given (usually checked) exception without adding the 
exception to the throws
      * clause of the calling method. This method prevents throws clause
-     * pollution and reduces the clutter of "Caused by" exceptions in the
+     * inflation and reduces the clutter of "Caused by" exceptions in the
      * stack trace.
      * <p>
-     * The use of this technique may be controversial, but exceedingly useful 
to
-     * library developers.
+     * The use of this technique may be controversial, but useful.
      * </p>
      * <pre>
-     *  public int propagateExample { // note that there is no throws clause
+     *  // There is no throws clause in the method signature.
+     *  public int propagateExample {
      *      try {
-     *          return invocation(); // throws IOException
+     *          // Throws IOException
+     *          invocation();
      *      } catch (Exception e) {
-     *          return ExceptionUtils.rethrowRuntimeException(e);  // 
propagates a checked exception
+     *          // Propagates a checked exception.
+     *          throw ExceptionUtils.asRuntimeException(e);
      *      }
+     *      // more processing
+     *      ...
+     *      return value;
      *  }
      * </pre>
      * <p>
@@ -94,16 +99,23 @@ public class ExceptionUtils {
      * checked exception in a RuntimeException:
      * </p>
      * <pre>
-     *  public int wrapExample { // note that there is no throws clause
+     *  // There is no throws clause in the method signature.
+     *  public int wrapExample() {
      *      try {
-     *          return invocation(); // throws IOException
+     *          // throws IOException.
+     *          invocation();
      *      } catch (Error e) {
      *          throw e;
      *      } catch (RuntimeException e) {
-     *          throw e;  // wraps a checked exception
+     *          // Throws an unchecked exception.
+     *          throw e;
      *      } catch (Exception e) {
-     *          throw new UndeclaredThrowableException(e);  // wraps a checked 
exception
+     *          // Wraps a checked exception.
+     *          throw new UndeclaredThrowableException(e);
      *      }
+     *      // more processing
+     *      ...
+     *      return value;
      *  }
      * </pre>
      * <p>

Reply via email to