Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-23

[Configuration] Property throwExceptionOnMissing is not respected for subsets

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None
    • Bugzilla Id:
      31540

      Description

      public void testNoSuchElementExceptionFoSubsets() {
      BaseConfiguration config = new BaseConfiguration();
      config.setThrowExceptionOnMissing(true);
      config.addProperty("subset.foo", "bar");
      try

      { config.getString("subset.foobar"); fail("NoSuchElementException expected"); }

      catch(NoSuchElementException e)

      { // expected }
      try { config.subset("subset").getString("foobar"); fail("NoSuchElementException expected"); } catch(NoSuchElementException e) { // expected }

      }

      This behaviour is currently a showstopper, since I rely on the thrown exception.
      Note: subset() returns a plain Configuration interface, that does not have the
      setThrowExceptionOnMissing setter.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              joehni Joerg Schaible
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: