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

Fix the NPE introduced into Lessons in SAK-44770

    XMLWordPrintable

    Details

    • 21 Status:
      Resolved
    • 20 status:
      Resolved
    • Test Plan:
      Hide

      Import a cartridge using the Lessons -> More Tools -> External Tool Import from www.py4e.com (I will have to show you how to set it up) and then try to launch the content the content.  Without the patch - boom! NPE.

       

      Show
      Import a cartridge using the Lessons -> More Tools -> External Tool Import from www.py4e.com (I will have to show you how to set it up) and then try to launch the content the content.  Without the patch - boom! NPE.  

      Description

      If you import a common cartridge Lessons -> More Tools -> External Tool Import and try to launch its content, lessons blows up with an NPE.

      This is in code introduced in SAK-44770

      85a13aebb34 (Brian Jones 2020-12-10 20:11:03 +0000 4963)

      You could claim this is pretty arcane use case and even claim that the cartridge import might have missed populating some field - and we can and should figure all that out - but the code is pretty susceptible to NPEs as written using chaining.

      I have made a patch, that just wraps the very complex chained method string in a try / except

      {{ String externalPageTitle = simplePageBean.getCurrentSite().getPage(page.getToolId()).getTools().stream()}}
      {{ .filter(t -> t.getId().equals(toolManager.getCurrentPlacement().getId()))}}
      {{ .findFirst()}}
      {{ .map(t -> t.getTitle())}}
      {{ .orElse("");}}

       

      java.lang.NullPointerException
      {{ at org.sakaiproject.lessonbuildertool.tool.producers.ShowPageProducer.createEditTitleDialog(ShowPageProducer.java:4963)}}
      {{ at org.sakaiproject.lessonbuildertool.tool.producers.ShowPageProducer.createDialogs(ShowPageProducer.java:3630)}}
      {{ at org.sakaiproject.lessonbuildertool.tool.producers.ShowPageProducer.fillComponents(ShowPageProducer.java:1221)}}
      {{ at uk.org.ponder.rsf.view.support.ViewCollector.fillComponents(ViewCollector.java:56)}}
      {{ at uk.org.ponder.rsf.view.support.LayoutCollector.fillComponents(LayoutCollector.java:68)}}
      {{ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)}}
      {{ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)}}
      {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
      {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
      {{ at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)}}
      {{ at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)}}
      {{ at com.sun.proxy.$Proxy292.fillComponents(Unknown Source)}}
      {{ at uk.org.ponder.rsf.view.support.ViewGenerator.generateView(ViewGenerator.java:53)}} 

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  bjones86 Brian Jones
                  Reporter:
                  csev Charles Severance
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration