--- a/src/PosixMQHandler.h Wed Apr 20 20:59:48 2022 +0200
+++ b/src/PosixMQHandler.h Sat Apr 30 23:22:48 2022 +0200
@@ -53,6 +53,7 @@
public:
PosixMQHandler(Configuration configuration) : configuration(configuration) {
+ // TODO: do not throw exception from the constructor: PosixMQ::open()
mq.reset(PosixMQ::open(convertor.to_bytes(configuration.queue), configuration.unlinkOnClose));
}
@@ -63,8 +64,10 @@
void attribute(const relpipe::common::type::StringX& value) override {
auto attributeName = currentRelation.attributes[currentRelation.attributeIndex].getAttributeName();
- if (attributeName == L"text") currentRelation.currentValue = convertor.to_bytes(value);
- else if (attributeName == L"data") currentRelation.currentValue = Hex::fromHex(value).str();
+ if (attributeName == L"text" && value.size()) currentRelation.currentValue = convertor.to_bytes(value);
+ else if (attributeName == L"data" && value.size()) currentRelation.currentValue = Hex::fromHex(value).str();
+ else if (attributeName == L"text"); // keep empty or value from 'data'
+ else if (attributeName == L"data"); // keep empty or value from 'text'
currentRelation.attributeIndex++;
if (currentRelation.attributeIndex == currentRelation.attributes.size()) {