You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2009/10/20 08:24:59 UTC

[jira] Updated: (LANG-539) Compile commons.lang for CDC 1.1/Foundation 1.1

     [ https://issues.apache.org/jira/browse/LANG-539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-539:
-------------------------------

    Fix Version/s:     (was: 2.x)
                   3.0

> Compile commons.lang for CDC 1.1/Foundation 1.1
> -----------------------------------------------
>
>                 Key: LANG-539
>                 URL: https://issues.apache.org/jira/browse/LANG-539
>             Project: Commons Lang
>          Issue Type: Wish
>    Affects Versions: 2.4
>            Reporter: Wim
>             Fix For: 3.0
>
>
> I try to compile the commons.lang for use on small memory devices. All classes compile fine against CDC 1.1/Foundation 1.1 except ExceptionUtils which uses the SQLException class which is not defined in this environment. Is it possible to replace the source with the reflection version:
> Index: ExceptionUtils.java
> ===================================================================
> --- ExceptionUtils.java	(revision 32)
> +++ ExceptionUtils.java	(working copy)
> @@ -22,7 +22,6 @@
>  import java.lang.reflect.Field;
>  import java.lang.reflect.InvocationTargetException;
>  import java.lang.reflect.Method;
> -import java.sql.SQLException;
>  import java.util.ArrayList;
>  import java.util.Arrays;
>  import java.util.List;
> @@ -361,8 +360,13 @@
>      private static Throwable getCauseUsingWellKnownTypes(Throwable throwable) {
>          if (throwable instanceof Nestable) {
>              return ((Nestable) throwable).getCause();
> -        } else if (throwable instanceof SQLException) {
> -            return ((SQLException) throwable).getNextException();
> +        } else if (throwable.getClass().getName().equals("java.sql.SQLException")) {
> +        	  try {
> +				return (Throwable) throwable.getClass().getMethod("getNextException", null).invoke(throwable, null);
> +			} catch (Exception e) {
> +				// Should not happen
> +				return null;
> +				}
>          } else if (throwable instanceof InvocationTargetException) {
>              return ((InvocationTargetException) throwable).getTargetException();
>          } else {
> @@ -459,7 +463,7 @@
>  
>          if (throwable instanceof Nestable) {
>              return true;
> -        } else if (throwable instanceof SQLException) {
> +        } else if (throwable.getClass().getName().equals("java.sql.SQLException")) {
>              return true;
>          } else if (throwable instanceof InvocationTargetException) {
>              return true;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.