Sai Zhang created DERBY-6381:
--------------------------------
Summary: Invalid/unexpected configuration values should not be
silently ignored
Key: DERBY-6381
URL: https://issues.apache.org/jira/browse/DERBY-6381
Project: Derby
Issue Type: Bug
Environment: any environment
Reporter: Sai Zhang
Fix For: 10.0.2.2, 10.11.0.0
Hi all,
I was using Derby for a while, but found Derby does not handle misconfiguration
well in many cases, which confuses me a lot.
Specifically, when users provide a wrong configuration option and Derby
produces a wrong result (or crashes), Derby should explicitly dump error
message pointing to the mis-configured option, rather than failing silently, or
dumping stack traces, or simply restoring to the default behavior. At least,
the invalid configuration values should be logged.
I have found many places in Derby which can be improved, to give users better
experience.
As a very simple example, Derby permits users to specify the log seversity via
the "derby.stream.error.logSeverityLevel" option. This option should only take
*integer* values within a certain range.
However, if a careless user uses "o" (not 0) or other illegal values like 1000,
Derby will automatically restore to use the default value notifying users that
they provide a wrong configuration option value. This occurs to me a few times,
and makes me really confused.
I dig into Derby's source code a bit, and found Derby silent ignore an invalid
configuration value, and use the default value. Here is the relevant code:
PropertyUtil.java
public static int handleInt(String value, int min, int max, int defaultValue) {
if (value == null)
return defaultValue;
try {
int intValue = Integer.parseInt(value);
if ((intValue >= min) && (intValue <= max))
return intValue;
}
catch (NumberFormatException nfe)
{
// just leave the default.
}
return defaultValue;
}
I feel at least, in the above example, the "//just leave the default" should
log the invalid value. So that users (like me) can easily identify their faults
rather than spending hours finding the root causes. Such code enhancement
should be quite easy.
I found a couple of such places. and wondering whether Derby developers would
like to know them, and how do you think about such "mis-handling"?
Thanks
-Sai
--
This message was sent by Atlassian JIRA
(v6.1#6144)