Skip to content

Null pointer in ParticleMathMapping.refreshMathDescription #1660

@danv61

Description

@danv61

We try to access forward and reverse rate of a mass action stochastic function which may be null.
Happens in ParticleMathMapping.refreshMathDescription() around line 732
Here's the significant part of the code:

				StochasticFunction stochasticFunction = StochasticTransformer.transformToStochastic(reactionStep);
				if (stochasticFunction instanceof MassActionStochasticFunction)
				{
					maFunc = (MassActionStochasticFunction)stochasticFunction;
				}
				if ((maFunc.forwardRate() == null && maFunc.reverseRate() == null))   <-- maFunc may be null here

Comes from VCell Support bug report, here's a small part of a (huge) stack trace:

Sent: Wednesday, April 8, 2026 8:13:56 AM (UTC-05:00) Eastern Time (US & Canada)
To: Virtual Cell Support
Subject: VCell Support sent through Contact-Us
Log file content:
NetworkFreePanel: SimContext@7f231fc9([Name(non spatial determintic), key(308949947), Owner(Sybren(304037797)), GroupAccess(Private), BranchPointRef(null), BranchID(308044382), Flag(Current), Date(02-Apr-2026 08:01:57), Annot(Length\u003d26)]), appendToConsole
Clean
NetworkFreePanel: SimContext@7f231fc9([Name(non spatial determintic), key(308949947), Owner(Sybren(304037797)), GroupAccess(Private), BranchPointRef(null), BranchID(308044382), Flag(Current), Date(02-Apr-2026 08:01:57), 
......
java.lang.NullPointerException: Cannot invoke \"cbit.vcell.mapping.stoch.MassActionStochasticFunction.forwardRate()\" because \"maFunc\" is null\r
	at cbit.vcell.mapping.ParticleMathMapping.refreshMathDescription(ParticleMathMapping.java:732)\r
	at cbit.vcell.mapping.ParticleMathMapping.refresh(ParticleMathMapping.java:1073)\r
	at cbit.vcell.mapping.AbstractMathMapping.getMathDescription(AbstractMathMapping.java:888)\r
	at cbit.vcell.mapping.AbstractMathMapping.getMathDescription(AbstractMathMapping.java:902)\r
	at cbit.vcell.client.task.DocumentValidTask.run(DocumentValidTask.java:68)\r
	at cbit.vcell.client.task.ClientTaskDispatcher.runTask(ClientTaskDispatcher.java:677)\r
	at cbit.vcell.client.task.ClientTaskDispatcher$1.construct(ClientTaskDispatcher.java:380)\r
	at swingthreads.SwingWorker$2.run(SwingWorker.java:109)\r
	at java.base/java.lang.Thread.run(Thread.java:833)\r
","softwareVersion":"Rel_Version_7.7.0_build_47","platform":"Running under Java 17.0.7, published by JetBrains s.r.o., on the amd64 architecture running version 10.0 of the Windows 11 operating system"}

The model may be entirely corrupted, the stack trace is full of all sort of exceptions

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

Status

Pool

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions