Velocity
  1. Velocity
  2. VELOCITY-544

BooleanPropertyExecutor refers to primitive boolean not object Boolean

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None

      Description

      note from Will: not sure if this is an actual bug or just a confusion re: the source. need to investigate.

      an example of a user-visible symptom would be helpful. see Christopher's note.

      ---------- Forwarded message ----------
      From: Adam Bishop (DSLWN) <AdamB@datacom.co.nz>
      Date: May 3, 2007 10:15 PM
      Subject: BooleanPropertyExecutor bug
      To: dev@velocity.apache.org

      getMethod().getReturnType() != Boolean.TYPE

      returns true if the method return type is Boolean rather than boolean.
      (i.e. it doesn't like the Boolean class, just the boolean primitive)

      the line should be

      getMethod().getReturnType() != Boolean.TYPE &&
      getMethod().getReturnType()!=Boolean.class

      bug exists in 1.3.1 and 1.5

      ---------------------------------------------------------------------
      To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
      For additional commands, e-mail: dev-help@velocity.apache.org

      ---------- Forwarded message ----------
      From: Christopher Schultz <chris@christopherschultz.net>
      Date: May 4, 2007 9:59 AM
      Subject: Re: BooleanPropertyExecutor bug
      To: Velocity Developers List <dev@velocity.apache.org>

      ----BEGIN PGP SIGNED MESSAGE----
      Hash: SHA1

      All,

      I haven't looked at the code, but introspection often has special cases
      for primitive types, whereas their wrapper types (java.lang.Boolean, in
      this case) are handled generically as Objects.

      Are we sure that java.lang.Boolean.class is appropriate to check in this
      case?

      Adam did not provide an example of how to demonstrate the existence of
      the bug... just an assertion that the code was not sufficient.

      • -chris

        Activity

        Hide
        Jarkko Viinamäki added a comment -

        I can confirm that there's a bug in current SVN head.

        Velocity fails to detect methods of type public Boolean isXXXX(). The fix suggested in this issue works so I included that and a test case in the attached patch.

        Show
        Jarkko Viinamäki added a comment - I can confirm that there's a bug in current SVN head. Velocity fails to detect methods of type public Boolean isXXXX(). The fix suggested in this issue works so I included that and a test case in the attached patch.

          People

          • Assignee:
            Unassigned
            Reporter:
            Will Glass-Husain
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development