Uploaded image for project: 'Unitils'
  1. UNI-263

getGetter method of ReflectionUtils returns 'null' for boolean fields

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      ReflectionUtils.getGetter returns null if the field is of type Boolean (wrapper) and not boolean (primitive).

      // replace following condition..
      if (result == null && Boolean.TYPE.equals(clazz.getDeclaredField(propertyName).getType())) { .. }

      // .. with
      if (result == null
         && (Boolean.TYPE.equals(clazz.getDeclaredField(propertyName).getType())
            || Boolean.class.equals(clazz.getDeclaredField(propertyName).getType())) { .. }
      and

      The org.unitils.util.ReflectionUtils.getGetter(Method, boolean) doesn't recognize a primitive boolean type. The getGetter method tries to find a getVariable() getter instead of an isVariable() getter.

        Attachments

          Activity

            People

            • Assignee:
              WillemijnW Willemijn Wouters
              Reporter:
              WillemijnW Willemijn Wouters
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: