SubsetOp NullPointerException

Hi Everyone,

I’m experiencing an odd problem when attempting to use gpt (snap 7.0, unix) in batch processing mode while trying to crop an S2 product via geo coordinates.

When running a command such as:
gpt ${graphXmlPath} -e -p ${parameterFilePath} -t ${targetFile} ${sourceFile}

I get the following stack trace:

at org.esa.snap.core.gpf.common.SubsetOp.initialize(
at org.esa.snap.core.gpf.internal.OperatorContext.initializeOperator(
at org.esa.snap.core.gpf.internal.OperatorContext.getTargetProduct(
at org.esa.snap.core.gpf.Operator.getTargetProduct(

Error: java.lang.NullPointerException

Some of the strangeness:

  • This works just fine if I apply the same subset via the SNAP visual interface (same geo coordinates)
  • This works just fine if I use my laptop’s windows installation to apply the same subset, both using the visual interface and gpt directly from command prompt (same xml graph, properties file, etc.)
  • The line of code that throws the NPE shouldn’t even be run (?). If I’m reading things correctly, that line is only executed if the geo region defined is null (which I know it isn’t!)

Any thoughts on this? I did a search on this forum and JIRA and didn’t spot it as a duplicate, but please let me know if I have missed this discussion somewhere else.

Thanks for any insight, or help with the issue. It is much appreciated!


the exception is already not inline anymore with the latest code.
Have you installed the latest module updates for SNAP?

Hi @marpet!

Thanks for taking a look! Yes, I believe I should be having the up to date modules (although if you say that this isn’t in the code anymore, there must be something I’m missing!). Here’s what I’ve done:

> $ snap --modules --refresh --update-all
Refreshing SNAP Community Extensions
Refreshing SNAP
Refreshing SNAP Extensions
Updates not found.

Similarly, while using the graphical interface, going to Help > Check for updates, returns no updates available.

Thanks again!

Sigh … perhaps it did update something while I wasn’t looking. After re-checking the updates, I ran my command again as a final sanity check, and I no longer have the exception.

Very sorry about that, and thank-you very much for the hint!

1 Like