Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1043

PropertyDisplayBlocks causes NullPointerException when property of type Calendar is null

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.0
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Using a Bean Display Grid with a bean with a null calendar throws a null pointer exception.

      org.apache.tapestry5.corelib.pages.PropertyDisplayBlocks.getCalendarDate(PropertyDisplayBlocks.java:56)

      Fix is trivial, simple check that the value is not null before calling getTime().

      public Date getCalendarDate()
      {
      Calendar calendar = (Calendar) context.getPropertyValue();
      if (calendar!=null)

      { return calendar.getTime(); }

      return null;
      }

        Attachments

          Activity

            People

            • Assignee:
              igor.drobiazko Igor Drobiazko
              Reporter:
              obastard Pierce Wetter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: