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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3c2b0670e53 Pipe: Fixed the validation logic of OpcDaConnector & 
Optimized the error message when the system is not Windows (#15339)
3c2b0670e53 is described below

commit 3c2b0670e531c7a20af6380a68cde30f65860603
Author: Caideyipi <[email protected]>
AuthorDate: Thu Apr 17 12:15:56 2025 +0800

    Pipe: Fixed the validation logic of OpcDaConnector & Optimized the error 
message when the system is not Windows (#15339)
---
 .../iotdb/db/pipe/connector/protocol/opcda/OpcDaConnector.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcda/OpcDaConnector.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcda/OpcDaConnector.java
index 7da59b86ef9..2d123ff3fc7 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcda/OpcDaConnector.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcda/OpcDaConnector.java
@@ -27,6 +27,7 @@ import 
org.apache.iotdb.pipe.api.customizer.parameter.PipeParameterValidator;
 import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters;
 import org.apache.iotdb.pipe.api.event.Event;
 import org.apache.iotdb.pipe.api.event.dml.insertion.TabletInsertionEvent;
+import org.apache.iotdb.pipe.api.exception.PipeParameterNotValidException;
 
 import org.apache.tsfile.utils.Pair;
 import org.slf4j.Logger;
@@ -58,8 +59,7 @@ public class OpcDaConnector implements PipeConnector {
   public void validate(final PipeParameterValidator validator) throws 
Exception {
     // TODO: upgrade this logic after "1 in 2" logic is supported
     validator.validate(
-        args ->
-            (((boolean) args[1] || (boolean) args[2] || (boolean) args[3] || 
(boolean) args[4])),
+        args -> (boolean) args[0] || (boolean) args[1] || (boolean) args[2] || 
(boolean) args[3],
         String.format(
             "One of '%s', '%s', '%s' and '%s' must be specified",
             SINK_OPC_DA_CLSID_KEY,
@@ -70,6 +70,10 @@ public class OpcDaConnector implements PipeConnector {
         validator.getParameters().hasAttribute(CONNECTOR_OPC_DA_CLSID_KEY),
         validator.getParameters().hasAttribute(SINK_OPC_DA_PROGID_KEY),
         validator.getParameters().hasAttribute(CONNECTOR_OPC_DA_PROGID_KEY));
+
+    if (!System.getProperty("os.name").toLowerCase().startsWith("windows")) {
+      throw new PipeParameterNotValidException("opc-da-sink must run on 
windows system.");
+    }
   }
 
   @Override

Reply via email to