Setting PlainVariable value: IllegalArgumentException

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

Moderator: uasdkjava

Post Reply
danky
Jr. Member
Jr. Member
Posts: 1
Joined: 04 Jun 2015, 10:37

Setting PlainVariable value: IllegalArgumentException

Post 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?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Setting PlainVariable value: IllegalArgumentException

Post by Support Team »

Hello,

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

Best regards
Support Team

Post Reply