[GitHub] [commons-lang] arturobernalg opened a new pull request #729: LANG-1647 - Check if an throwable is a checked exception

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg opened a new pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox

arturobernalg opened a new pull request #729:
URL: https://github.com/apache/commons-lang/pull/729


   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 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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls commented on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox

coveralls commented on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37689616/badge)](https://coveralls.io/builds/37689616)
   
   Coverage increased (+0.0003%) to 94.917% when pulling **c97c5b86a5b14f889371f6f2d8a5877882e7caed on arturobernalg:feature/LANG-1647** into **0cfc31b98778767cb2f8db93bc2f488abe058e2e on apache:master**.
   


----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] aherbert commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

aherbert commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588445520



##########
File path: src/changes/changes.xml
##########
@@ -100,6 +100,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="add" dev="jochen">Introduce the use of @Nonnull, and @Nullable, and the Objects class as a helper tool.</action>
     <action                   type="add" dev="ggregory" due-to="Arturo Bernal, Gary Gregory">Add and use true and false String constants #714.</action>
     <action                   type="add" dev="ggregory" due-to="Arturo Bernal, Gary Gregory">Add and use ObjectUtils.requireNonEmpty() #716.</action>
+    <action issue="LANG-1647" type="add" dev="abernal"  due-to="">Check if an throwable is a checked exception.</action>

Review comment:
       This is in the wrong place

##########
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
+     */
+    public static boolean isCheckedException(final Throwable throwable) {
+        return throwable != null && !(throwable instanceof RuntimeException || throwable instanceof Error);

Review comment:
       `instanceof` handles null. Does this work if you remove the `throwable != null &&`?
   
   I would expect in the majority of cases this would be called with a non-null object so this simplifies the code.




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

arturobernalg commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588473270



##########
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
+     */
+    public static boolean isCheckedException(final Throwable throwable) {
+        return throwable != null && !(throwable instanceof RuntimeException || throwable instanceof Error);

Review comment:
       I prefer to leave all options open. it is more versatile. ...




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

arturobernalg commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588474872



##########
File path: src/changes/changes.xml
##########
@@ -100,6 +100,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="add" dev="jochen">Introduce the use of @Nonnull, and @Nullable, and the Objects class as a helper tool.</action>
     <action                   type="add" dev="ggregory" due-to="Arturo Bernal, Gary Gregory">Add and use true and false String constants #714.</action>
     <action                   type="add" dev="ggregory" due-to="Arturo Bernal, Gary Gregory">Add and use ObjectUtils.requireNonEmpty() #716.</action>
+    <action issue="LANG-1647" type="add" dev="abernal"  due-to="">Check if an throwable is a checked exception.</action>

Review comment:
       true. thanks. @aherbert




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] aherbert commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

aherbert commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588481429



##########
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
+     */
+    public static boolean isCheckedException(final Throwable throwable) {
+        return throwable != null && !(throwable instanceof RuntimeException || throwable instanceof Error);

Review comment:
       My point was that you do not need the `throwable != null`. It should still pass your unit tests (i.e. return false if null is passed).




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

arturobernalg commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588486562



##########
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
+     */
+    public static boolean isCheckedException(final Throwable throwable) {
+        return throwable != null && !(throwable instanceof RuntimeException || throwable instanceof Error);

Review comment:
       No. Return true without the null check  




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls edited a comment on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

coveralls edited a comment on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37694223/badge)](https://coveralls.io/builds/37694223)
   
   Coverage decreased (-0.006%) to 94.922% when pulling **f9dfe4bf50dc9b20c8432a9095dff0392b518b71 on arturobernalg:feature/LANG-1647** into **a2b2b35ac3b969686c647e57f5ca3bacc63f2c56 on apache:master**.
   


----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] garydgregory commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

garydgregory commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588526579



##########
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
+     */
+    public static boolean isCheckedException(final Throwable throwable) {

Review comment:
       The API name is misleading since it takes more than Exception as input.
   Going further, I think the type name in the method name is redundant and calling the API 'isChecked' should be enough.




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] garydgregory commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

garydgregory commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588527970



##########
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:
       Adding a new API is not a maintenance version change per semantic versioning guidelines, the version should be the next minor one.




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

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 u 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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls edited a comment on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

coveralls edited a comment on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37698405/badge)](https://coveralls.io/builds/37698405)
   
   Coverage increased (+0.007%) to 94.936% when pulling **bc45e24706b1e07a21ddf04a955fa0a6652eb67f on arturobernalg:feature/LANG-1647** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**.
   


----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls edited a comment on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

coveralls edited a comment on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37698420/badge)](https://coveralls.io/builds/37698420)
   
   Coverage increased (+0.007%) to 94.936% when pulling **bc45e24706b1e07a21ddf04a955fa0a6652eb67f on arturobernalg:feature/LANG-1647** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**.
   


----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

arturobernalg commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588759468



##########
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
+     */
+    public static boolean isCheckedException(final Throwable throwable) {

Review comment:
       Changed




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls edited a comment on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

coveralls edited a comment on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37701301/badge)](https://coveralls.io/builds/37701301)
   
   Coverage increased (+0.007%) to 94.936% when pulling **1f970afcacc1a263c5466bd6a1a2fe5aa1cf68e7 on arturobernalg:feature/LANG-1647** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**.
   


----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls edited a comment on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

coveralls edited a comment on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37701306/badge)](https://coveralls.io/builds/37701306)
   
   Coverage increased (+0.007%) to 94.936% when pulling **1f970afcacc1a263c5466bd6a1a2fe5aa1cf68e7 on arturobernalg:feature/LANG-1647** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**.
   


----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] arturobernalg commented on a change in pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

arturobernalg commented on a change in pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#discussion_r588839645



##########
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
   Changed




----------------------------------------------------------------
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]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-lang] coveralls edited a comment on pull request #729: LANG-1647 - Check if an throwable is a checked exception

GitBox
In reply to this post by GitBox

coveralls edited a comment on pull request #729:
URL: https://github.com/apache/commons-lang/pull/729#issuecomment-791480927


   
   [![Coverage Status](https://coveralls.io/builds/37704871/badge)](https://coveralls.io/builds/37704871)
   
   Coverage increased (+0.007%) to 94.936% when pulling **73f2b7381dc0e68e1fb8ba311434b6af1ebdd7b3 on arturobernalg:feature/LANG-1647** into **6b9964ff4b89205d63eac3db005757edf19e9dda on apache:master**.
   


----------------------------------------------------------------
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]


12