Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6381

Invalid/unexpected configuration values should not be silently ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • Miscellaneous
    • None
    • any environment

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              szhang Sai Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified