Meng-Shuan Tsai created HDDS-16322:
--------------------------------------
Summary: ConfigurationSource.getClass loads property key instead
of configured class name
Key: HDDS-16322
URL: https://issues.apache.org/jira/browse/HDDS-16322
Project: Apache Ozone
Issue Type: Bug
Reporter: Meng-Shuan Tsai
Assignee: Meng-Shuan Tsai
h2. Problem
This is a bug in ConfigurationSource.getClass (default method).
The method reads the configured class name into valueString, but then calls
Class.forName(name) on the property key instead of the value. When the property
is set, it usually throws ClassNotFoundException wrapped in RuntimeException.
If the property key itself happens to be a loadable class name, the 2-arg
getClass returns that class instead of the configured one.
The same file's getClasses uses the configured class names correctly.
The 3-arg getClass(name, defaultValue, xface) delegates to the 2-arg method, so
it is affected as well. If the wrongly loaded class is not assignable to xface,
that overload still throws; it is silent only when the key-named class happens
to be assignable.
h2. Impact
OzoneConfiguration extends Hadoop Configuration, so the concrete Hadoop
getClass masks this default on OM / SCM / Datanode. Implementations that only
implement ConfigurationSource (LegacyHadoopConfigurationSource,
InMemoryConfigurationForTesting) hit the buggy default.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]