This issue is archived. You can view it, but you can't modify it. Learn more

ExportXMLWordPrintable

      MemoryChunk.getLastNode() returns null although FlowChunk.getLastNode() has @NonNull on it. This causes NPE in other usage, such as when calling StatusAndTiming.computeChunkTiming() in graph analysis, where it expects lastNode to be non-null.

      StatusAndTiming.computeChunkTiming(run, chunk.getPauseTimeMillis(), firstExecuted, chunk.getLastNode(), chunk.getNodeAfter());
      

      Above code will cause NPE as chunk.getLastNode() returns null. This happens with non-block stage scripts where one stage follows another.

      node {
          stage 'Stage 1'
          stage 'Stage 2'
             echo 'hello'
      }
      

      I can work around in my code by checking chunk.getLastNode() as being not null, but this results in this confusing API where @Nonnull contract is broken resulting in to NPE and consumers putting null check after the fact.

            Assignee:
            Unassigned
            Reporter:
            Vivek Pandey
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: