Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-65304

Trying to retrieve content for trashed pages return 500 errors using api because of Create date is null

XMLWordPrintable

      Issue Summary

      Some pages for some reason lose or are created without created data associated with them.

      That causes several different errors on Confluence, which we have some other bugs already explaining them like:
      https://jira.atlassian.com/browse/CONFSERVER-60169
      https://jira.atlassian.com/browse/CONFSERVER-59982
      https://jira.atlassian.com/browse/CONFSERVER-58270

      The one found by one of our customers is that when trying to do an API call for content it returns a 500 error, in case there is any page without the creation date associated, and if they try to do that for trashed items like the rest below the same happen even with pages that have status DELETED:

      curl -u username:password -X GET “http://localhost:8090/rest/api/content?expand=history.lastUpdated&status=trashed”
      

      Steps to Reproduce

      1. Have a page with the creationdate null on the database
      2. Perform an API call that will retrieve the data of that page
      3. API will return
        {“statusCode”:500,“message”:“”,“reason”:“Internal Server Error”}
        

      Expected Results

      Return the data in an XML format
      content_api.xml

      Actual Results

      {“statusCode”:500,“message”:“”,“reason”:“Internal Server Error”}
      

      The below exception is thrown in the xxxxxxx.log file:

      [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error :
       -- url: /rest/api/content/<ID>/child/page | traceId: xxxxx | userName: admin
      java.lang.NullPointerException
              at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
              at com.atlassian.confluence.api.model.content.History$HistoryBuilder.createdDate(History.java:231)
      

      Workaround

      Run the following query on the database:

      SELECT * from content where creationdate is NULL and content_status != 'draft';
      

      Either remove them manually from the page after identifying the pages or add a dummy entry for date like:

      UPDATE content SET creationdate ='2021-01-01 01:01:01.001', lastmoddate = '2021-01-01 01:01:01.001' where creationdate is NULL and content_status != 'draft'
      

              Unassigned Unassigned
              ddresch@atlassian.com Dilan Dresch
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: