commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis Lundberg (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LOGGING-90) [logging] org.apache.commons.logging.impl.LogFactoryImpl does not provide enough information on an InvocationTargetException in the newInstance() method.
Date Tue, 29 Dec 2009 14:10:29 GMT

     [ 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: 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.


Mime
View raw message