changeset 4688:177ad026d219

backward compatibility with old DicomModification serialization from Orthanc <= 1.6.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jun 2021 10:09:54 +0200
parents fcd2dc7c8f31
children ead3b81f4541
files OrthancFramework/Sources/DicomParsing/DicomModification.cpp
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Wed Jun 09 17:24:44 2021 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Jun 10 10:09:54 2021 +0200
@@ -1453,11 +1453,26 @@
     allowManualIdentifiers_ = SerializationToolbox::ReadBoolean(serialized, ALLOW_MANUAL_IDENTIFIERS);
     keepStudyInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_STUDY_INSTANCE_UID);
     keepSeriesInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SERIES_INSTANCE_UID);
-    keepSopInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SOP_INSTANCE_UID);
     updateReferencedRelationships_ = SerializationToolbox::ReadBoolean
       (serialized, UPDATE_REFERENCED_RELATIONSHIPS);
     isAnonymization_ = SerializationToolbox::ReadBoolean(serialized, IS_ANONYMIZATION);
 
+    if (serialized.isMember(KEEP_SOP_INSTANCE_UID))
+    {
+      keepSopInstanceUid_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SOP_INSTANCE_UID);
+    }
+    else
+    {
+      /**
+       * Compatibility with jobs serialized using Orthanc between
+       * 1.5.0 and 1.6.1. This compatibility was broken between 1.7.0
+       * and 1.9.3: Indeed, an exception was thrown in "ReadBoolean()"
+       * if "KEEP_SOP_INSTANCE_UID" was absent, because of changeset:
+       * https://hg.orthanc-server.com/orthanc/rev/3860
+       **/
+      keepSopInstanceUid_ = false;
+    }
+
     if (serialized.isMember(PRIVATE_CREATOR))
     {
       privateCreator_ = SerializationToolbox::ReadString(serialized, PRIVATE_CREATOR);