Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-195

Lodaing of Digester Rules for classes extending ValidatorResources does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.0 Release, 1.3.0 Release
    • 1.3.1 Release
    • Framework
    • None
    • Windows/Unix

    Description

      If we extend the class "ValidatorResources", then the loading of the digester rules does not work properly.

      --------------------------------ValidatorResources--------------------------------------------------------
      private Digester initDigester() {
      URL rulesUrl = this.getClass().getResource("digester-rules.xml");
      -----------------------------------------------------------------------------------------------------------------------
      The above line tries to find the "digester-rules.xml" from the path of extending class and hence to make this work we need to
      copy the digester rules xml file in the same pacakge as the extending class.

      I think a better way might be is to accept a InputStream or URL for the digester rules in the constructor if someone wants to
      have their custom digester rules, and by default if it's not provided it should always take from the ValidatorResources path
      by changing the code

      this.getClass().getResource("digester-rules.xml");

      to

      ValidatorResources.class.getResource("digester-rules.xml");

      Thanks
      Vijay

      Attachments

        Activity

          People

            niallp Niall Pemberton
            vijpan Vijay Pandey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: