This is an automated email from the ASF dual-hosted git repository.

justinchen pushed a commit to branch new_opc_server
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/new_opc_server by this push:
     new 2f08e9a95e1 fix
2f08e9a95e1 is described below

commit 2f08e9a95e18438ed4091eca66b776177edf8dd7
Author: Caideyipi <[email protected]>
AuthorDate: Thu Dec 4 15:42:37 2025 +0800

    fix
---
 .../pipe/sink/protocol/opcua/OpcUaNameSpace.java   | 66 +++++++++++-----------
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
index 350373894ff..0386c59decf 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
@@ -57,7 +57,6 @@ import 
org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText;
 import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
 import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode;
 import org.eclipse.milo.opcua.stack.core.types.builtin.Variant;
-import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass;
 import org.eclipse.milo.opcua.stack.core.types.structured.AddNodesItem;
 import org.eclipse.milo.opcua.stack.core.types.structured.AddNodesResult;
 import org.eclipse.milo.opcua.stack.core.types.structured.VariableAttributes;
@@ -528,37 +527,40 @@ public class OpcUaNameSpace extends 
ManagedNamespaceWithLifecycle {
 
       // Construct node
       UaNode newNode = null;
-      if (item.getNodeClass().equals(NodeClass.Variable)) {
-        final VariableAttributes variableAttributes =
-            (VariableAttributes)
-                
item.getNodeAttributes().decode(getServer().getSerializationContext());
-        newNode =
-            new UaVariableNode.UaVariableNodeBuilder(getNodeContext())
-                .setNodeId(nodeId.get())
-                .setAccessLevel(variableAttributes.getAccessLevel())
-                .setUserAccessLevel(variableAttributes.getUserAccessLevel())
-                .setBrowseName(item.getBrowseName())
-                .setDisplayName(variableAttributes.getDisplayName())
-                .setDataType(variableAttributes.getDataType())
-                .setTypeDefinition(typeDefinition.get())
-                .setValueRank(variableAttributes.getValueRank())
-                .setWriteMask(variableAttributes.getWriteMask())
-                .setUserWriteMask(variableAttributes.getUserWriteMask())
-                
.setMinimumSamplingInterval(variableAttributes.getMinimumSamplingInterval())
-                .build();
-        ((UaVariableNode) newNode)
-            .setValue(
-                new DataValue(
-                    variableAttributes.getValue(),
-                    StatusCode.GOOD,
-                    new DateTime(),
-                    new DateTime()));
-      }
-      if (Objects.isNull(newNode)) {
-        results.add(
-            new AddNodesResult(
-                new StatusCode(StatusCodes.Bad_NodeClassInvalid), 
NodeId.NULL_VALUE));
-        continue;
+      switch (item.getNodeClass()) {
+        case Variable:
+          final VariableAttributes variableAttributes =
+              (VariableAttributes)
+                  
item.getNodeAttributes().decode(getServer().getSerializationContext());
+          newNode =
+              new UaVariableNode.UaVariableNodeBuilder(getNodeContext())
+                  .setNodeId(nodeId.get())
+                  .setAccessLevel(variableAttributes.getAccessLevel())
+                  .setUserAccessLevel(variableAttributes.getUserAccessLevel())
+                  .setBrowseName(item.getBrowseName())
+                  .setDisplayName(variableAttributes.getDisplayName())
+                  .setDataType(variableAttributes.getDataType())
+                  .setTypeDefinition(typeDefinition.get())
+                  .setValueRank(variableAttributes.getValueRank())
+                  .setWriteMask(variableAttributes.getWriteMask())
+                  .setUserWriteMask(variableAttributes.getUserWriteMask())
+                  
.setMinimumSamplingInterval(variableAttributes.getMinimumSamplingInterval())
+                  .build();
+          ((UaVariableNode) newNode)
+              .setValue(
+                  new DataValue(
+                      variableAttributes.getValue(),
+                      StatusCode.GOOD,
+                      new DateTime(),
+                      new DateTime()));
+          break;
+        case Object:
+          break;
+        default:
+          results.add(
+              new AddNodesResult(
+                  new StatusCode(StatusCodes.Bad_NodeClassInvalid), 
NodeId.NULL_VALUE));
+          continue;
       }
 
       // Link reference

Reply via email to