[jira] [Work logged] (LANG-1647) Check if an throwable is a checked exception

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Work logged] (LANG-1647) Check if an throwable is a checked exception

Jannik Zuther (Jira)

     [ https://issues.apache.org/jira/browse/LANG-1647?focusedWorklogId=561636&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-561636 ]

ASF GitHub Bot logged work on LANG-1647:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Mar/21 22:39
            Start Date: 05/Mar/21 22:39
    Worklog Time Spent: 10m
      Work Description: arturobernalg commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588668912



##########
File path: src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
##########
@@ -586,6 +586,30 @@ public static int indexOfType(final Throwable throwable, final Class<? extends T
         return indexOf(throwable, type, fromIndex, true);
     }
 
+    /**
+     * Return whether the given throwable is a checked exception:
+     * that is, neither a RuntimeException nor an Error.
+     *
+     * <pre>
+     * ExceptionUtils.isCheckedException(new Exception())                    = true
+     * ExceptionUtils.isCheckedException(new SQLException())                 = true
+     * ExceptionUtils.isCheckedException(new RuntimeException())             = false
+     * ExceptionUtils.isCheckedException(new IllegalArgumentException(""))   = false
+     * ExceptionUtils.isCheckedException(new Throwable())                    = true
+     * ExceptionUtils.isCheckedException(null)                               = false
+     * </pre>
+     *
+     * @param throwable the throwable to check
+     * @return whether the throwable is a checked exception
+     * @see java.lang.Exception
+     * @see java.lang.RuntimeException
+     * @see java.lang.Error
+     * @since 3.12.1

Review comment:
       HI @garydgregory
   
   Don't understand. what version should i put in order to maintain the guidelines?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 561636)
    Time Spent: 2.5h  (was: 2h 20m)

> Check if an throwable is a checked exception
> --------------------------------------------
>
>                 Key: LANG-1647
>                 URL: https://issues.apache.org/jira/browse/LANG-1647
>             Project: Commons Lang
>          Issue Type: Improvement
>            Reporter: Arturo Bernal
>            Priority: Minor
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> The idea it's have a function that check if a given throwable is a checked exception. There are some similar function in ConcurrentUtils, but have package visibility and return the same exception. 
> Seem logic have this verification in the class that have this responsibility - ExceptionUtils



--
This message was sent by Atlassian Jira
(v8.3.4#803005)