[
https://jira.jboss.org/jira/browse/JBTM-641?page=com.atlassian.jira.plugi...
]
Jacques-Olivier Goussard commented on JBTM-641:
-----------------------------------------------
Understood. Then it's really a matter of describing the contract LogFactories are
supposed to honor. You can either simply state that all LogFactories must have a single
arg ctor (which IMHO is the simplest thing to do), or must have either a single arg ctor
or a no arg ctor. Both ways suit me.
com.arjuna.common.util.logging.LogFactory#loadFactory does not handle
properly null argument
--------------------------------------------------------------------------------------------
Key: JBTM-641
URL:
https://jira.jboss.org/jira/browse/JBTM-641
Project: JBoss Transaction Manager
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: JTS
Affects Versions: 4.8.0
Environment: standalone (J2SE) use of jbossts-jta-4.8.0.GA.zip
Reporter: Jacques-Olivier Goussard
com.arjuna.common.util.logging.LogFactory#setupLogSystem makes calls to
com.arjuna.common.util.logging.LogFactory#loadFactory("com.arjuna.common.internal.util.logging.jakarta.JakartaLogFactory",
null) when the jakarta log system is selected.
When the logger class name argument is nullm the loadfactory will try to instanciate the
"com.arjuna.common.internal.util.logging.jakarta.JakartaLogFactory" class with a
no-arg constructor and this class does NOT have a
no-arg ctor.
private static LogFactoryInterface loadFactory(String classname, String arg) throws
LogConfigurationException
{
try {
Class factoryClass =
Thread.currentThread().getContextClassLoader().loadClass(classname);
LogFactoryInterface logFactoryInterface = null;
if(arg == null) {
// THIS WILL FAIL AS
"com.arjuna.common.internal.util.logging.jakarta.JakartaLogFactory" AS NO SUCH
CTOR
logFactoryInterface = (LogFactoryInterface)factoryClass.newInstance();
} else {
Constructor ctor = factoryClass.getConstructor(new Class[] {
String.class});
logFactoryInterface = (LogFactoryInterface)ctor.newInstance(arg);
}
return logFactoryInterface;
} catch (Exception e) {
throw new LogConfigurationException(e);
}
}
Proposed fix: The fix is to simply always forward the argument to the String arg ctor -
with a null arg, the JakartaLogFactory will properly
use the default logger from commons.logging
private static LogFactoryInterface loadFactory(String classname, String arg) throws
LogConfigurationException
{
try {
Class factoryClass =
Thread.currentThread().getContextClassLoader().loadClass(classname);
LogFactoryInterface logFactoryInterface = null;
Constructor ctor = factoryClass.getConstructor(new Class[] { String.class});
logFactoryInterface = (LogFactoryInterface)ctor.newInstance(arg);
return logFactoryInterface;
} catch (Exception e) {
throw new LogConfigurationException(e);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira