Tapestry 5
  1. Tapestry 5
  2. TAP5-1043

PropertyDisplayBlocks causes NullPointerException when property of type Calendar is null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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;
      }

        Activity

        Pierce Wetter created issue -
        Igor Drobiazko made changes -
        Field Original Value New Value
        Assignee Igor Drobiazko [ igor.drobiazko ]
        Igor Drobiazko made changes -
        Summary Beans with null Calendar values throw exceptions (fix included) PropertyDisplayBlocks causes NullPointerException when property of type Calendar is null
        Igor Drobiazko made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 5.2.0 [ 12314122 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development