Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3187

ServletBinding lies about what variables it can handle

    XMLWordPrintableJSON

Details

    Description

      If you look at the current implementation of ServletBinding in trunk, method getVariables() is not an accurate depiction of what variables getVariable will to respond to.

      public Map getVariables() {
      return binding.getVariables();
      }

      This returns the list of variables that were specifically created through setVariable. But if you look at the implementation of getVariable it inspects the name of the property that is being requested and will handle an additional three variables out, sout and html. Giving the fact that getVariables is the only way to inspect if a binding is aware of a specific variable without dealing with exception handling (getVariable throws an exeception if it cant find said variable) this seems like a bug.

      The two possible solutions being:
      1.) Provide a method to determine the existence of a variable without having to catch exceptions
      or
      2.) Register out, sout and html via setVariable and not property name inspection in getVariable

      Attachments

        1. ServletBinding.java.patch
          2 kB
          Stephen Solka
        2. ServletBindingTest.groovy.patch
          1 kB
          Stephen Solka
        3. Clean_ServletBinding.java.patch
          5 kB
          Stephen Solka
        4. servlet3187_fix.patch
          3 kB
          paulk_asert
        5. Groovy3187Wrapper.patch
          6 kB
          Jochen Theodorou

        Activity

          People

            paulk Paul King
            trashhalo Stephen Solka
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: