-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Affects Version/s: 8.5.14
-
Component/s: Core - Content REST APIs
-
1
-
Severity 3 - Minor
Problem
When using the Confluence DC REST API to search for spaces and request to expand the description, an error 500 occurs when the value of spacedescid is set as NULL in the spaces table.
/rest/api/space?expand=description
Environment
Confluence DC
Steps to Reproduce
- Create a space in Confluence
- Set a space description
- Set the value for spacedescid as NULL in the database using the space key
UPDATE spaces SET spacedescid = NULL WHERE spacekey = <Space Key>;
- Clear Confluence DC cache
- Send a request to Confluence REST API for the space with an expand=description
<Base URL>/rest/api/space/<Space Key?expand=description
Expected Results
Actual Results
An error 500 will be returned to the request, and you can find the following entries in the logs.
2024-11-21 11:36:36,849 ERROR [http-nio-8090-exec-11 url: /confluence/rest/api/latest/space; user:-] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error : -- url: /confluence/rest/api/latest/space | userName: - | traceId: - com.atlassian.confluence.api.impl.pagination.BatchExecutionException: Error during batch execution with session management ... Caused by: java.lang.NullPointerException: Cannot invoke "com.atlassian.confluence.spaces.SpaceDescription.getBodyAsString()" because the return value of "com.atlassian.confluence.spaces.Space.getDescription()" is null
Workaround
- Find the affected space with the following query
SELECT * FROM spaces s WHERE s.spacedescid IS NULL
- Get the Space Key and navigate to edit its description
<Base URL>/spaces/editspace.action?key=<Space Key>
- Update the space description and save