You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dennis Lundberg (JIRA)" <ji...@apache.org> on 2009/12/29 15:10:29 UTC

[jira] Updated: (LOGGING-90) [logging] org.apache.commons.logging.impl.LogFactoryImpl does not provide enough information on an InvocationTargetException in the newInstance() method.

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

Dennis Lundberg updated LOGGING-90:
-----------------------------------

    Affects Version/s:     (was: 1.0.4)
                       1.0.3
        Fix Version/s: 1.0.4

> [logging] org.apache.commons.logging.impl.LogFactoryImpl does not provide enough information on an InvocationTargetException in the newInstance() method.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOGGING-90
>                 URL: https://issues.apache.org/jira/browse/LOGGING-90
>             Project: Commons Logging
>          Issue Type: Improvement
>    Affects Versions: 1.0.3
>         Environment: Operating System: Solaris
> Platform: Sun
>            Reporter: Brian Curnow
>            Priority: Minor
>             Fix For: 1.0.4
>
>
> Using version 1-0-3 I was getting an 
> org.apache.commons.logging.LogConfigurationException while attempting to 
> retrieve a Log instance from the LogFactory. This LogConfigurationException was 
> wrapping an InvocationTargetException from the newInstance() method in 
> org.apache.commons.logging.impl.LogFactoryImpl. An InvocationTargetException 
> does not provide any information regarding the cause of the exception in its' 
> stack trace so I had a difficult time determining the true cause of the error 
> (A ClassNotFoundException).
> I would suggest adding a special case to the existing catch clause in 
> newInstance() to catch an InvocationTargetException and throw a new 
> LogConfigurationExeption constructed with the cause (not the 
> InvocationTargetException object).
> The following would be the new catch clause:
>         } catch (InvocationTargetException e) {
>             throw new LogConfigurationException(e.getCause());
>         } catch (Throwable t) {
>             throw new LogConfigurationException(t);
>         }
> The modified newInstance() method would look like this:
>     protected Log newInstance(String name) throws LogConfigurationException {
>         Log instance = null;
>         try {
>             Object params[] = new Object[1];
>             params[0] = name;
>             instance = (Log) getLogConstructor().newInstance(params);
>             if (logMethod != null) {
>                 params[0] = this;
>                 logMethod.invoke(instance, params);
>             }
>             return (instance);
>         } catch (InvocationTargetException e) {
>             throw new LogConfigurationException(e.getCause());
>         } catch (Throwable t) {
>             throw new LogConfigurationException(t);
>         }
>     }

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