splatch commented on code in PR #2458:
URL: https://github.com/apache/plc4x/pull/2458#discussion_r2836622650
##########
plc4j/spi/src/main/java/org/apache/plc4x/java/spi/Plc4xNettyWrapper.java:
##########
@@ -198,7 +198,9 @@ protected void decode(ChannelHandlerContext
channelHandlerContext, T payload, Li
logger.trace("Failure while processing payload {} with
handler {}", message, registration, e);
BiConsumer biConsumer = registration.getErrorConsumer();
if(biConsumer != null) {
- biConsumer.accept(message, e);
+ // Use the original payload rather than the
transformed message,
+ // as the error consumer expects the original message
type.
+ biConsumer.accept(payload, e);
Review Comment:
Error handlers are "global", hence by introducing this change you may break
some drivers in situations which we do not test.
##########
plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/readwrite/UnknownExtensionObject.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.plc4x.java.opcua.readwrite;
+
+import java.util.Arrays;
+import java.util.Objects;
+import org.apache.plc4x.java.spi.generation.SerializationException;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBufferBoxBased;
+
+/**
+ * Represents an ExtensionObject whose type is not known to the parser.
+ * Stores the raw body bytes so they can be interpreted later based on context
+ * (e.g., the tag's dataType hint).
+ */
+public class UnknownExtensionObject extends ExtensionObjectDefinition {
Review Comment:
Please move this definition to mspec.
##########
protocols/opcua/src/main/xslt/opc-manual.xsl:
##########
@@ -225,7 +225,7 @@
[typeSwitch encodingMask.xmlBody, encodingMask.binaryBody
['false', 'true' BinaryExtensionObjectWithMask
[implicit int 32 bodyLength 'body == null ? 0 :
body.lengthInBytes']
- [simple ExtensionObjectDefinition('extensionId') body]
+ [manual ExtensionObjectDefinition body
'STATIC_CALL("parseExtensionObjectBody", readBuffer, extensionId, bodyLength)'
'STATIC_CALL("serializeExtensionObjectBody", writeBuffer, body)' 'body == null
? 0 : body.lengthInBits']
Review Comment:
I understand reason for the change, but better move it needed logic and
`UnknownExtensionObject` to mspec, so it will be portable across languages.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]