Login  •  Register


Setting PlainVariable value: IllegalArgumentException

Questions regarding the use of the Java SDK for Server or Client development or integration into customer products ...

Setting PlainVariable value: IllegalArgumentException

Postby danky » 04 Jun 2015, 10:52

Hi everyone,

I'm experiencing problems when setting the value of a PlainVariable<OwnClass>. Can't a PlainVariable handle any type of content?

Code: Select all
PlainVariable<MyOwnTestClass> myVariable = new PlainVariable<MyOwnTestClass> (nodeManager, myVarId, "my variable", Locale.ENGLISH);
myVariable.setCurrentValue(new MyOwnTestClass());


The trace tells me com.prosysopc.ua.server.nodes.PlainVariable.setCurrentValue throws an IllegalArgumentException because "Variant cannot be MyOwnTestClass". I actually chose PlainVariable in order to store custom objects. Is there a way to do this?

On a related note, why does a PlainVariable<String> still have its DataType set to BaseDataType? It only becomes String if I manually setDataTypeId(Identifiers.String). What exactly does the Type in PlainVariable<Type> type anyway?
danky
Jr. Member
Jr. Member
 
Posts: 1
Joined: 04 Jun 2015, 10:37

Re: Setting PlainVariable value: IllegalArgumentException

Postby Support Team » 05 Jun 2015, 09:44

Hello,

please refer to http://forum.prosysopc.com/forum/opc-ua ... ion/#p1333

Best regards
Support Team
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2420
Joined: 18 Mar 2011, 15:09

Re: Setting PlainVariable value: IllegalArgumentException

Postby katedaisy » 24 Jun 2019, 10:37

Thanks for this wonderful article and continue sharing more topics like this.
katedaisy
Jr. Member
Jr. Member
 
Posts: 1
Joined: 24 Jun 2019, 10:35


Return to JAVA based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests