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

com.xpn.xwiki.api.Document.getPreviousVersion() throws NPE if current version is the first one

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.4 M1
    • 2.3 M2
    • {Unused} APIs
    • None
    • Unit
    • Unknown

    Description

      Test case:

      {{velocity}}
      #set($xdoc = $xwiki.getDocument("Sandbox.WebHome"))
      ##
      ## Get archive to make sure the problem is not XWIKI-4265
      $xdoc.getArchive()
      $xdoc.getPreviousVersion()
      {{/velocity}}
      

      Try this on a document which has not been altered (v1.1)
      Observe NPE
      Alter the document and restart the wiki engine (to make absolutely sure it isn't XWIKI-4265).
      Run the test, observe no NPE.

      What should getPreviousVersion do if there is none? return "0"? return null? Surely not throw NPE.

      Attachments

        Activity

          People

            sdumitriu Sergiu Dumitriu
            calebjamesdelisle CalebJamesDeLisle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: