cancel
Showing results for 
Search instead for 
Did you mean: 

When does ISimpleValueServices.getSVServices() deliver null?

Former Member
0 Kudos

Hello,

I get a null pointer exception in the following line of code:

ISimpleType simpleType = wdContext.nodeOrg().getNodeInfo() .getAttribute(IOrgElement.PERSON).getSimpleType();

ISimpleValueSet valueSet = simpleType.getSVServices().getValues();

simpleType is not null, but getSVServices() delivers null. Help says "...If no valueservices are avaliable, null is delivered.." I read dozens of forum entries and googled, but nobody ever checks getSVServices() for null.

The node is not singleton and at the time this code runs it is not sure whether an element exists and whether the valueset is already set. But then I would expect either the node or the simpleType or the getValues() to be null.

When creating the valueset, the code

IModifiableSimpleValueSet modValueSet = modSimpleType.getSVServices().getModifiableSimpleValueSet();

does also not check for null and this never was a problem. Is there a difference between IModifiableSimpleValueSet and ISimpleType in this case?

Thanks in advance

Josef

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Ayyapparaj,

now I check the simpleType.getSVServices() for null before proceeding. The question was just to learn how and in what situations this can be and what these services do.

Thanks

Josef

Former Member
0 Kudos

Hi Sharanya,

thanks for your answer. Yes, the context is created in the component controller and mapped to the view. In the component controller the IModifiableSimpleValueSet is used to create the value set. The view asks for the ISimpleValueSet to initialize a table sorter.

The problem is not that I try to change the datatype or valueset of a mapped attribute (that leads to the known error message "Must not modify the datatype of a mapped attribute"). That's not the case. But what I do is asking the view attribute for its valueset using ISimpleValueSet. And I'm not sure if this has something to do with the mapping because a few moments later the same call works and simpleType.getSVServices() is not null anymore.

Josef

Former Member
0 Kudos

Hi,

You can check this before the call using

ISimpleTypeModifiable modifiable = wdContext.getNodeInfo().getAttribute("Your Attribute").getModifiableSimpleType();

modifiable.hasSVService()

Regards

Ayyapparaj

Former Member
0 Kudos

hai josef,

when u use IModifiable simple valueset you shoud not map the attribute of that particular input field where u need to get the value help to any other attribute in other views or controller.This is because when we use IModifiable and do mapping it wont work.Thats not the case with ISimple type so better check if you have done any mapping of that particular field in context.

Thanks n Regards

Sharanya.R