[ 
https://issues.apache.org/jira/browse/DERBY-6381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen closed DERBY-6381.
-------------------------------------

            Resolution: Duplicate
         Fix Version/s:     (was: 10.11.0.0)
                            (was: 10.0.2.2)
    Bug behavior facts:   (was: Deviation from standard)

Sounds like a good idea. DERBY-2844 suggests more or less the same improvement, 
so I'm closing this report as a duplicate. Feel free to add a vote for that 
issue to make it more visible. (Or a patch. :))

> 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
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> 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)

Reply via email to