cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime plug: createNavigationTarget(): NullPointerException

Former Member
0 Kudos

Hi folks!

i'm trying to create a navigation link between an at runtime created outboundplug, and an inboundplug from a interfaceView.

I got: <b>srcViewUsage.createNavigationTarget(stepPlug.getName(),targetViewUsage,inplug.getName());</b>

But this gives an error:

<b>java.lang.NullPointerException: Can't set a relation role because o==null and the role cardinality is 1.

at com.sap.tc.webdynpro.repository.RepositoryObject.setRelatedModelObject(RepositoryObject.java:525)

at com.sap.tc.webdynpro.progmodel.repository.IWDNavigationTargetReferenceInfo$Implementation.setTargetInternal(IWDNavigationTargetReferenceInfo.java:171)

at com.sap.tc.webdynpro.progmodel.repository.IWDViewUsageInfo$Implementation.createNavigationTarget(IWDViewUsageInfo.java:780)

at com.flexso.test.roadbody.Start.createStepPlug(Start.java:226)

at com.flexso.test.roadbody.wdp.InternalStart.createStepPlug(InternalStart.java:148)

at com.flexso.test.roadbody.Start.wdDoModifyView(Start.java:150)</b>

any ideas?

thx in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi Kristof,

Some sources

[code]

//IWDViewUsageInfo$Implementation.createNavigationTarget

public com.sap.tc.webdynpro.progmodel.repository.IWDNavigationTargetReferenceInfo createNavigationTarget( java.lang.String sourcePlugName, com.sap.tc.webdynpro.progmodel.repository.IWDViewUsageInfo targetViewUsage, java.lang.String targetPlugName ) {

.......

// inbound plug of the target view

IWDInboundPlugInfo.IFramework targetInboundPlugInfo =

(IWDInboundPlugInfo.IFramework)((IWDAbstractViewInfo.IFramework) targetViewUsage.getView()).findInInboundPlugs(targetPlugName);

.........

navigationTargetReferenceInfo.setTargetInternal(targetInboundPlugInfo);//Line 780

//IWDNavigationTargetReferenceInfo$Implementation.setTargetInternal

public void setTargetInternal(com.sap.tc.webdynpro.progmodel.repository.IWDInboundPlugInfo.IFramework value) {

setRelatedModelObject("Target", (com.sap.tc.webdynpro.repository.api.IWDRepositoryModelClass)value);//Line 171

}

//RepositoryObject.setRelatedModelObject

public void setRelatedModelObject(String rolename, ICMIModelClass o) {

.....

CMICardinality rolecard = associatedModelClassInfo().getTargetRoleInfo(rolename).getCardinality();

if(o == null && rolecard.isMandatory())

throw new NullPointerException("Can't set a relation role because o==null and the role cardinality is 1.");//525

......

[/code]

So, seems like you are passing name of non existing inbound plug ( inplug.getName() ).

Best regards, Maksim Rashchynski.

Answers (1)

Answers (1)

Former Member
0 Kudos

Yes, in a way, you were right. I was using the wrong targetViewUsage. I solved it now.

Thx for your quick answer.

Former Member
0 Kudos

Hi all,

unfortunately I am the same error message as steted above (java.lang.NullPointerException: Can't set a relation role because o==null and the role cardinality is 1.)

Could anybody please post, how this issue has been solved? Seems to be an issue with the targetViewUsage. Probably someone could post a code snippet?

Thank you and kind regards, Patrick.