NPE can occur in GraphBuilder if ZNAP is selected as output format

Description

The following exception can occur in the GraphBuilder when ZNAP is selected as target format
java.lang.NullPointerException
        at org.esa.snap.dataio.znap.ZnapProductWriter.close(ZnapProductWriter.java:229)
        at org.esa.snap.core.datamodel.Product.closeProductWriter(Product.java:666)
        at org.esa.snap.core.datamodel.Product.closeIO(Product.java:690)
        at org.esa.snap.core.datamodel.Product.dispose(Product.java:716)
        at org.esa.snap.core.gpf.graph.NodeContext.dispose(NodeContext.java:173)
        at org.esa.snap.core.gpf.graph.GraphContext.dispose(GraphContext.java:210)
        at org.esa.snap.graphbuilder.rcp.dialogs.support.GraphExecuter.recreateGraphContext(GraphExecuter.java:275)

In the close method of the ZnapProductWriter class the zarrStore is null.
This happens only if the product wasn’t written because the store is only created when needed.

A simple null check should fix this.

As a workaround for users:
First set up the graph and when done select ZNAP as target format. Then the execution should work.

Environment

None

GitHub Work

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Components

Priority

Created 18 May 2022 at 07:50
Updated 19 August 2022 at 13:37
Resolved 31 May 2022 at 11:02

Flag notifications