Page 1 of 1

Setting PlainVariable value: IllegalArgumentException

Posted: 04 Jun 2015, 10:52
by danky
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?

Re: Setting PlainVariable value: IllegalArgumentException

Posted: 05 Jun 2015, 09:44
by Support Team
Hello,

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

Best regards
Support Team