Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-9326

NumberProperty#equals throws NullPointer exception when one of the properties is null

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce:

      • create a class with a Date property for which you programmatically set the value for "EmptyIsToday" to null.
      • edit the class and check "EmptyIsToday".

      In the server logs you will see

      ERROR .o.i.DefaultObservationManager - Failed to send event [org.xwiki.bridge.event.DocumentUpdatedEvent@d43b8e0c] to listener [com.xpn.xwiki.internal.event.XClassPropertyEventGeneratorListener@691639c6] 
      

      If you have watchlist notifications and trigger for instance the hourly notifier, you will see

      [DefaultQuartzScheduler_Worker-10] ERROR o.x.v.i.DefaultVelocityEngine  - Exception in macro #displayhtmldiff called at xwiki:XWiki.WatchListMessage[line 148, column 9] 
      
      Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHTMLDiff' in  class com.xpn.xwiki.plugin.watchlist.WatchListEvent threw exception java.lang.NullPointerException at xwiki:XWiki.WatchListMessage[line 148, column 33]
      
      Caused by: java.lang.NullPointerException
      at com.xpn.xwiki.objects.NumberProperty.equals(NumberProperty.java:66)
      at com.xpn.xwiki.objects.BaseCollection.equals(BaseCollection.java:578)
      at com.xpn.xwiki.objects.classes.BaseClass.getDiff(BaseClass.java:1201)
      at com.xpn.xwiki.doc.XWikiDocument.getClassDiff(XWikiDocument.java:5767)
      at com.xpn.xwiki.plugin.watchlist.WatchListEvent.getHTMLDiff(WatchListEvent.java:534)
      at sun.reflect.GeneratedMethodAccessor513.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
      

      Attachments

        Issue Links

          Activity

            People

              enygma Eduard Moraru
              raluca.moisa Raluca Moisa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: