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

Renaming key metadata fields (e.g. dc.title) can result in NullPointerExceptions

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 6.0
    • Component/s: DSpace API
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      3
    • Documentation Status:
      Not Required

      Description

      This issues is being reported based on something that actually occurred on http://demo.dspace.org

      On the demo site, someone logged in as an Administrator and simply renamed the "dc.title" metadata field to be "dc.titlejaira":
      1. Login as an Admin
      2. Visit the 'dc' schema in the registry
      3. Click on the 'dc.title' field, rename it and click Update

      After this change was made, the entire site became unresponsive, as any attempts to access 'dc.title' for any object resulted in the below NullPointerException. This meant that both XMLUI and JSPUI homepages were unable to load:

      Java stacktrace: java.lang.NullPointerException
      	at org.dspace.core.AbstractHibernateDSODAO.addMetadataLeftJoin(AbstractHibernateDSODAO.java:49)
      	at org.dspace.content.dao.impl.CommunityDAOImpl.findAllNoParent(CommunityDAOImpl.java:88)
      	at org.dspace.content.CommunityServiceImpl.findAllTop(CommunityServiceImpl.java:154)
      

      The above NullPointerException was being thrown because the "dc.title" field no longer existed in the registry, and it was being referenced by its name in the top-level communities listing (CommunityServiceImpl.findAllTop()).

      The only way to fix this issue was to change the field name back via a SQL UPDATE similar to the following (NOTE: in this case, I first had to determine the "metadata_field_id" of the old 'dc.title' field, which was 70. The ID may not be the same on all systems however)

      UPDATE metadatafieldregistry SET element='title' where metadata_field_id=70;
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: