You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/02/02 13:05:47 UTC
DO NOT REPLY [Bug 26598] New: -
org.apache.commons.logging.impl.LogFactoryImpl does not provide enough information on an InvocationTargetException in the newInstance() method.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26598>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26598
org.apache.commons.logging.impl.LogFactoryImpl does not provide enough information on an InvocationTargetException in the newInstance() method.
Summary: org.apache.commons.logging.impl.LogFactoryImpl does not
provide enough information on an
InvocationTargetException in the newInstance() method.
Product: Commons
Version: unspecified
Platform: Sun
OS/Version: Solaris
Status: NEW
Severity: Enhancement
Priority: Other
Component: Logging
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: bcurnow@gfs.com
CC: bcurnow@gfs.com
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);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org