# HG changeset patch # User Sebastien Jodogne # Date 1461308253 -7200 # Node ID ebce5f456b8ecfde0e07d2ce27622c05def3a070 # Parent 9e0f408db796b5899f2eb7ff42dca8a9be973d0f new error code: ErrorCode_AlreadyExistingTag diff -r 9e0f408db796 -r ebce5f456b8e Core/Enumerations.cpp --- a/Core/Enumerations.cpp Fri Apr 22 08:47:43 2016 +0200 +++ b/Core/Enumerations.cpp Fri Apr 22 08:57:33 2016 +0200 @@ -328,6 +328,9 @@ case ErrorCode_NoWorklistHandler: return "No request handler factory for DICOM C-Find Modality SCP"; + case ErrorCode_AlreadyExistingTag: + return "Cannot override the value of a tag that already exists"; + default: if (error >= ErrorCode_START_PLUGINS) { diff -r 9e0f408db796 -r ebce5f456b8e Core/Enumerations.h --- a/Core/Enumerations.h Fri Apr 22 08:47:43 2016 +0200 +++ b/Core/Enumerations.h Fri Apr 22 08:57:33 2016 +0200 @@ -139,6 +139,7 @@ ErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */, ErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */, ErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */, + ErrorCode_AlreadyExistingTag = 2042 /*!< Cannot override the value of a tag that already exists */, ErrorCode_START_PLUGINS = 1000000 }; diff -r 9e0f408db796 -r ebce5f456b8e OrthancServer/ParsedDicomFile.cpp --- a/OrthancServer/ParsedDicomFile.cpp Fri Apr 22 08:47:43 2016 +0200 +++ b/OrthancServer/ParsedDicomFile.cpp Fri Apr 22 08:57:33 2016 +0200 @@ -576,6 +576,11 @@ const Json::Value& value, bool decodeDataUriScheme) { + if (pimpl_->file_->getDataset()->tagExists(ToDcmtkBridge::Convert(tag))) + { + throw OrthancException(ErrorCode_AlreadyExistingTag); + } + InvalidateCache(); std::auto_ptr element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, GetEncoding())); diff -r 9e0f408db796 -r ebce5f456b8e OrthancServer/main.cpp --- a/OrthancServer/main.cpp Fri Apr 22 08:47:43 2016 +0200 +++ b/OrthancServer/main.cpp Fri Apr 22 08:57:33 2016 +0200 @@ -592,6 +592,7 @@ PrintErrorCode(ErrorCode_SslDisabled, "Orthanc has been built without SSL support"); PrintErrorCode(ErrorCode_CannotOrderSlices, "Unable to order the slices of the series"); PrintErrorCode(ErrorCode_NoWorklistHandler, "No request handler factory for DICOM C-Find Modality SCP"); + PrintErrorCode(ErrorCode_AlreadyExistingTag, "Cannot override the value of a tag that already exists"); } std::cout << std::endl; diff -r 9e0f408db796 -r ebce5f456b8e Plugins/Include/orthanc/OrthancCPlugin.h --- a/Plugins/Include/orthanc/OrthancCPlugin.h Fri Apr 22 08:47:43 2016 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Fri Apr 22 08:57:33 2016 +0200 @@ -278,6 +278,7 @@ OrthancPluginErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */, OrthancPluginErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */, OrthancPluginErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */, + OrthancPluginErrorCode_AlreadyExistingTag = 2042 /*!< Cannot override the value of a tag that already exists */, _OrthancPluginErrorCode_INTERNAL = 0x7fffffff } OrthancPluginErrorCode; diff -r 9e0f408db796 -r ebce5f456b8e Resources/ErrorCodes.json --- a/Resources/ErrorCodes.json Fri Apr 22 08:47:43 2016 +0200 +++ b/Resources/ErrorCodes.json Fri Apr 22 08:57:33 2016 +0200 @@ -518,5 +518,10 @@ "Code": 2041, "Name": "NoWorklistHandler", "Description": "No request handler factory for DICOM C-Find Modality SCP" + }, + { + "Code": 2042, + "Name": "AlreadyExistingTag", + "Description": "Cannot override the value of a tag that already exists" } ]