System is returning a 500 error rather than a 404

XMLWordPrintable

    • Severity 3 - Minor

      Issue Summary

      This is reproducible on Data Center: (yes) / (no)

      We got a ticket from where the partner mentioned getting 500 Internal Server Error: "{"statusCode":500,"message":"java.lang.NullPointerException: null"}" on calls to /rest/api/content/1135050765/history/15/macro/id/.

      When checking for the available contentid, we noticed that related to contentId=1135050765, there are only available versions 6 (set current) and 1 (set as a draft), as can be seen below:

      contentid,hibernateversion,contenttype,title,lowertitle,version,creator,creationdate,lastmodifier,lastmoddate,versioncomment,prevver,content_status,pageid,spaceid,child_position,parentid,messageid,pluginkey,pluginver,parentccid,draftpageid,draftspacekey,drafttype,draftpageversion,parentcommentid,username
      21135247365,288,PAGE,Registrations Control - CardView,registrations control - cardview,1,8a7f80897594bce201759505d68e0000,2023-02-06T17:20:10.96Z,8a7f80897594bce201759505d68e0000,2023-02-22T07:05:19.42Z,,1135050765,draft,,1134559385,1476,1134560809,,,,,,,,,,
      31135050765,391,PAGE,Registrations Control - CardView,registrations control - cardview,6,8a7f80897594bce201759505d68e0000,2023-02-06T17:18:49.746Z,8a7f80897594bce201759505d68e0000,2023-02-12T17:03:50.876Z,,,current,,1134559385,528,1134560809,,,,,,,,,, 

      However, since they’re trying to access something that doesn't exist, instead of a 500 response code, it's not expected that it would bring a 400 Bad Request or even a 404 Not Found error.

      This is not the first case that the partner is reporting this kind of error message; however, we could see that this time, the atlassian/atlassian-connect-spring-boot is already under its last version.

      Steps to Reproduce

      1. N/A

      Expected Results

      According to our knowledge and confirmation obtained from the engineering team that analyzed the case, a 404 error was expected to occur.

      Actual Results

      The below exception is thrown in the logs:

      stack: java.lang.NullPointerException: Cannot invoke "com.atlassian.confluence.core.ContentEntityObject.getBodyAsString()" because "content" is null
      2com.atlassian.confluence.api.impl.service.content.ContentMacroServiceImpl$MacroInstanceFinderImpl.internalFetchByMacroId(ContentMacroServiceImpl.java:130)
      3com.atlassian.confluence.api.impl.service.content.ContentMacroServiceImpl$MacroInstanceFinderImpl.fetchOne(ContentMacroServiceImpl.java:110)
      4com.atlassian.confluence.plugins.restapi.resources.ContentResource.getMacroBodyByMacroId(ContentResource.java:838)
      5jdk.internal.reflect.GeneratedMethodAccessor3259.invoke(Unknown Source)

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

            Assignee:
            Unassigned
            Reporter:
            Vinicius Benedini
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: