cancel
Showing results for 
Search instead for 
Did you mean: 

Class Cast Exception

Former Member
0 Kudos

Hi

I got class cast exception here

String value = String.valueOf

(((IPrivateMaterialApplicationView.IMaterial_InputElement)(wdContext.nodeMaterial_Input().nodeT_Matno_in().getElementAt(i))).getMatnr());

valueSet.put(value,value);

Thanks & Regards

Ravi Shankar B

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

Tyr This

String value = String.valueOf

(((IPrivateMaterialApplicationView.IT_Matno_inElement)(wdContext.nodeT_Matno_in().getElementAt(i))).getMatnr());

Kind Regards

Mukesh

former_member182372
Active Contributor
0 Kudos

Hi Ravi,

You are trying to case element from node T_Matno_in (which`s name most probably is IPrivateMaterialApplicationView.IT_Matno_inElement) to node element from node Material_Input (IPrivateMaterialApplicationView.IMaterial_InputElement).

I would suggest you follwoing piece of code:

wdContext.nodeMaterial_Input().nodeT_Matno_in().getT_Matno_inElement(i).getMatnr()

Make sure that "typed access required" property set to true for all nodes.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi,

It should be:


String value = String.valueOf
(((IPrivateMaterialApplicationView.IT_Matno_inElement)(wdContext.nodeMaterial_Input().nodeT_Matno_in().getElementAt(i))).getMatnr());
valueSet.put(value,value);

Regards,

Satyajit.

Message was edited by: Satyajit Chakraborty

Former Member
0 Kudos

Ravi,

the cause of this issue is that

wdContext.nodeMaterial_Input().nodeT_Matno_in().getElementAt(i)

does not return an instance of type

IPrivateMaterialApplicationView.IMaterial_InputElement

.

Check what type is returned by this method (in NWDS place your cursor over the method and the return type is displayed) and cast to that type.

Regards

Sebastian