# HG changeset patch # User František Kučera # Date 1651353768 -7200 # Node ID 68b93b82f1cc19427c3d52ffe2792e2480e701cd # Parent b0b7b6f1bc884060129bf8a4827b9192f7d20dcc use 'text' or 'data' attribute according to presence of value diff -r b0b7b6f1bc88 -r 68b93b82f1cc src/PosixMQHandler.h --- 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()) {