Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
10.10.1.1
-
None
-
All envrionments
-
Known fix
-
Deviation from standard, Wrong query result
Description
Dear Derby developers,
I have been using Derby for a while, and think the configuration handling code should be improved. In particular, Derby should check the validity of a user-specified configuration value, rather than replacing an invalid value with the default.
Not sure that is a major issue or not. But at least it happens to me a couple of times, and causes lots of confusion. Thus, I strongly suggest to fix this.
How to reproduce the problem.
set:
derby.storage.pageSize= l2800 ( note the first char is "l" (L), not "1")
clearly, this invalid value should be notified immediately (or at least logged), however, Derby simply replaces that with the default value, which seems to be "32768". This is a real example, and causes confusion.
I looked at the code and found the improving code:
In class PropertyUtil
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 would suggest to add logging statements for the invalid cases, and produce an error message to indicate which configuration value is incorrect.
I have a few more such cases, if you are interested in improving the code, I am happy to share that too.
Please let me know your thought.
-Sai
Attachments
Issue Links
- duplicates
-
DERBY-2844 PropertyUtil should not silently ignore syntax errors in a property file
- Open