Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-2066

Invoking an action that returns null results in an NPE ... eg HelloWorldObject#delete().

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-M2
    • Component/s: None
    • Labels:
      None

      Description

      this stackt trace:

      Stack trace:
      java.lang.NullPointerException
      java.util.Objects#requireNonNull(Objects.java:203)
      java.util.Optional#<init>(Optional.java:96)
      java.util.Optional#of(Optional.java:108)
      java.util.stream.FindOps$FindSink$OfRef#get(FindOps.java:193)
      java.util.stream.FindOps$FindSink$OfRef#get(FindOps.java:190)
      java.util.stream.FindOps$FindOp#evaluateSequential(FindOps.java:152)
      java.util.stream.AbstractPipeline#evaluate(AbstractPipeline.java:234)
      java.util.stream.ReferencePipeline#findFirst(ReferencePipeline.java:464)
      org.apache.isis.viewer.wicket.model.models.ActionModel#executeAction(ActionModel.java:474)

       

      which results from this code:

      return routingServices
          .filter(routingService->routingService.canRoute(result))        
          .map(routingService->{
              final Object routeTo = routingService.route(result);
              return routeTo != null? getPersistenceSession().adapterFor(routeTo): null;
          })
          .findFirst()
          .orElse(resultAdapter);
      

       

      This isn't quite equivalent to the code in 1.16.x:

      final Object result = resultAdapter != null ? resultAdapter.getObject() : null;
      for (RoutingService routingService : routingServices) {
          final boolean canRoute = routingService.canRoute(result);
          if(canRoute) {
              final Object routeTo = routingService.route(result);
              return routeTo != null? getPersistenceSession().adapterFor(routeTo): null;
          }
      }
      
      return resultAdapter;
      

       

       

        Attachments

          Activity

            People

            • Assignee:
              danhaywood Daniel Keir Haywood
              Reporter:
              danhaywood Daniel Keir Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: