Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-18706

NPE when folder name is null in OSP:Portfolios (Presentations)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.6.1
    • Fix Version/s: None
    • Component/s: OSP: Portfolios
    • Labels:
      None

      Description

      If (for whatever reason) a user has a null folder name, OSP Portfolios blows up (java.lang.NullPointerException stack trace) when a user tries to Add/Edit Content.

      Relevant Error

      ERROR: Servlet.service() for servlet springapp threw exception (2010-06-28 09:41:35,916 TP-Processor10_org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/osp-presentation-tool].[springapp])
      java.lang.NullPointerException at org.theospi.portfolio.presentation.support.PresentationService.abbreviateResourceName(PresentationService.java:309)

      and you can see the problem in PresentationService:

      private String abbreviateResourceName(ContentResourceArtifact art) {
      String folder = art.getBase().getContainingCollection().getProperties().getProperty(ResourceProperties.PROP_DISPLAY_NAME);

      if (folder.length() > FOLDER_MAX_LEN)

      { int len = folder.length(); StringBuilder newFolder = new StringBuilder(folder.substring(0, FOLDER_ABBR_SIZE)); newFolder.append(FOLDER_ABBR_TOKEN); newFolder.append(folder.substring(len - FOLDER_ABBR_SIZE, len)); folder = newFolder.toString(); }

      the folder String is assumed to be valid, and not checked against a null value.

      It's a trivial fix... but I put this in also because this ticket could also be changed to why does Sakai allow null folder names? (e.g. why no not-null constraint in DB?) Obviously, if that gets fixed, this fix is not needed. However, there may be other reasons why a null folder name is needed that I don't understand, so I'll let someone else decide that aspect.

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                • Assignee:
                  osp-jira OSP Jira Team (Inactive)
                  Reporter:
                  reidda@missouri.edu David Reid (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Integration