changeset 2116:2fabd1073728

prevent registering two tags with the same symbolic name
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 31 Oct 2016 15:42:18 +0100
parents a657f7772e69
children 87b395a77c41
files OrthancServer/FromDcmtkBridge.cpp Resources/Configuration.json
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp	Mon Oct 31 15:23:32 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Mon Oct 31 15:42:18 2016 +0100
@@ -317,6 +317,13 @@
 
     {
       DictionaryLocker locker;
+
+      if (locker->findEntry(name.c_str()))
+      {
+        LOG(ERROR) << "Cannot register two tags with the same symbolic name \"" << name << "\"";
+        throw OrthancException(ErrorCode_AlreadyExistingTag);
+      }
+
       locker->addEntry(entry.release());
     }
   }
--- a/Resources/Configuration.json	Mon Oct 31 15:23:32 2016 +0100
+++ b/Resources/Configuration.json	Mon Oct 31 15:42:18 2016 +0100
@@ -326,6 +326,6 @@
   // possibly the Private Creator (for private tags).
   "Dictionary" : {
     // "0014,1020" : [ "DA", "ValidationExpiryDate", 1, 1 ]
-    // "00e1,10c2" : [ "UI", "PET-CT Multi Modality Name", 1, 1, "ELSCINT1" ]
+    // "00e1,10c2" : [ "SH", "PET-CT Multi Modality Name", 1, 1, "ELSCINT1" ]
   }
 }