Groovy
  1. Groovy
  2. GROOVY-3187

ServletBinding lies about what variables it can handle

    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

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

        Activity

          People

          • Assignee:
            Paul King
            Reporter:
            Stephen Solka
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development