Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-1896

XMLUI returns 500 response for most invalid "/static" URLs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3, 4.2, 5.0
    • Fix Version/s: 3.4 , 4.3, 5.1
    • Component/s: XMLUI
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      1
    • Documentation Status:
      Not Required

      Description

      Initially reported in this thread:
      http://dspace.2283337.n4.nabble.com/More-enterprise-deployment-questions-td4670528.html

      The DSpace XMLUI seems to respond with a 500 response (rather than a proper 404) for invalid paths which begin with "/static".

      There seems to be two forms of errors..

      1) NullPointerException (with 500 response) is thrown for URLs of this format:

      [dspace-xmlui-url]/static//.js
      [dspace-xmlui-url]/static//.css
      [dspace-xmlui-url]/static//.json

      In other words, the XMLUI path must start with "/static/", and it must end with either ".js", ".css" or ".json". Here's some examples from the demo.dspace.org server:
      http://demo.dspace.org/xmlui/static/not/a/valid/file.js (500 response)
      http://demo.dspace.org/xmlui/static/notvalid.css (500 response)

      2) FileNotFoundException is thrown (with an incorrect 500 response) for URLs that begin with "/static" and have a subpath. Again, some examples from demo.dspace.org:

      http://demo.dspace.org/xmlui/static/not/a/valid/path/ (500 response)
      http://demo.dspace.org/xmlui/static/blah/notvalid.html (500 response)
      http://demo.dspace.org/xmlui/static/notvalid.html (correct 404 response with a "ResourceNotFound" error)

      The underlying error IS BENIGN. Essentially, what is going on here is that we have some special processing to allow institutions to easily add custom Javascript or CSS files to their themes. Those custom files become available on the "/static" path. See this line in the sitemap.xmap:
      https://github.com/DSpace/DSpace/blob/master/dspace-xmlui/src/main/webapp/sitemap.xmap#L645

      Currently, if someone attempts to reference a .js/.css/.json file which does NOT exist, DSpace code is unfortunately throwing a Java NullPointerException (as it's failing to check if the requested file actually exists). Here's the line where the NullPointerException is thrown:
      https://github.com/DSpace/DSpace/blob/master/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/ConcatenationReader.java#L174

      While this error is annoying, and the 500 response is incorrect, it is benign. No javascript is being executed by DSpace. It's just an error where the underlying Java code is not checking for a possible "null" result (which only occurs when the requested .js/.css/*.json file is not found).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tdonohue Tim Donohue
              Reporter:
              tdonohue Tim Donohue
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: