cancel
Showing results for 
Search instead for 
Did you mean: 

Call to nodeInfo throws null pointer exception

Former Member
0 Kudos

I have a context node called Subst and want to bind a value set to one of its attributes using a modifiable simple valueset. So I called

wdContext.nodeSubst().getNodeInfo();

and got a null pointer exception because the nodeSubst is null. OK, I have cardinality 0..n, so at the moment I set the value set there is no node instance. But I want to set the value set for all node instances, not only for one. I changed the singleton property and it worked. But I don't understand why there is a difference between singleton or non-singleton and if it is important whether I have a value or model node.

Regards,

Josef

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Armin,

very quick answer! But the child node only exists if it (the child) is singleton? Cardinality is not important (set to 0..n)?

Is it correct that either the master node Reg must have an instance or the child node Subst must have singleton = true?

Regards,

Josef

Former Member
0 Kudos

Hi Josef,

Cardinality talks about the collection of the node i.e the number of elements a node can have.

Singleton is about the existence of a node instance with respect to its parent or element collection.

One instance of a singleton child node exists at runtime for one parent node instance. The contents of the child node instance change depending on the lead selection in the parent node. Node instance existence is per node basis.

Whereas, for a non-singleton node, there will be as many number of node instances as there are elements in the parent node. So parent node's cardinality, say 0..n, there will exist n child nodes. So node existence in this case is per element basis.

Regards,

Rajit

Answers (3)

Answers (3)

Former Member
0 Kudos

So if singleton there exists always exactly one node instance so it can never be null whereas for non-singleton node I first have to create elements or set the cardinality.

Thank you very much

Josef

Former Member
0 Kudos

Yes. For a non-singleton child node instance to exist, there must atleast be one element in the parent's collection.

Hope that's clear.

Regards,

Rajit

Former Member
0 Kudos

Hallo Armin,

yes, you are right, the node Subst that failed was a non singleton subnode. Now as a singleton node it works. The context structure looks like:

Context (Root)

......|

......|-> Reg (singleton)

............|

............|-> Subst

I still don't get it. When I call nodeSubst(), I assumed to get the node class, not an instance. Is that correct?

Regards,

Josef

Former Member
0 Kudos

No you get a node instance. For non-singleton child nodes, the node exists per element of its parent node. If the parent node is empty, no instance of the child node exists.

Armin

Former Member
0 Kudos

How does the context structure look like? I guess "Subst" is a non-singleton child node of some other node?

Armin