[ 
https://issues.apache.org/jira/browse/DERBY-6381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13799218#comment-13799218
 ] 

Sai Zhang commented on DERBY-6381:
----------------------------------

Thanks for confirming this report. I will report more similar issues in derby 
that I would like to be fixed soon.

Also, seems  this report identifies different places that should be improved 
than  DERBY-2844, even though both places are in the same Java file. 

I will vote to fix this issue since it helps a lot in reducing necessary 
confusions.

> 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