lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5568] Work around defects in certain admin-system extract


From: Greg Chicares
Subject: [lmi-commits] [5568] Work around defects in certain admin-system extracts
Date: Tue, 18 Sep 2012 02:09:49 +0000

Revision: 5568
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5568
Author:   chicares
Date:     2012-09-18 02:09:48 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
Work around defects in certain admin-system extracts

Modified Paths:
--------------
    lmi/trunk/multiple_cell_document.cpp

Modified: lmi/trunk/multiple_cell_document.cpp
===================================================================
--- lmi/trunk/multiple_cell_document.cpp        2012-09-16 23:17:17 UTC (rev 
5567)
+++ lmi/trunk/multiple_cell_document.cpp        2012-09-18 02:09:48 UTC (rev 
5568)
@@ -187,7 +187,27 @@
             << LMI_FLUSH
             ;
         }
-    *i >> temp;
+    // In some old extracts, case and class defaults were defectively
+    // empty except for a version-attribute node, which should always
+    // name exact version 5.
+    if(i->size() <= 1)
+        {
+        int version = 0;
+        xml_lmi::get_attr(*i, "version", version);
+        if(5 != version)
+            {
+            fatal_error()
+                << "Case-default 'cell' element is empty, but is version "
+                << version
+                << " where version 5 was expected."
+                << LMI_FLUSH
+                ;
+            }
+        }
+    else
+        {
+        *i >> temp;
+        }
     case_parms_.push_back(temp);
 
     // Number of classes.
@@ -215,7 +235,34 @@
     ++i;
     for(; i != elements.end(); ++i)
         {
-        *i >> temp;
+        // See comment on defective extracts above.
+        if(i->size() <= 1)
+            {
+            if(1 != number_of_classes)
+                {
+                fatal_error()
+                    << "Class-default 'cell' element is empty, and there are "
+                    << number_of_classes
+                    << " classes where 1 was expected."
+                    << LMI_FLUSH
+                    ;
+                }
+            int version = 0;
+            xml_lmi::get_attr(*i, "version", version);
+            if(5 != version)
+                {
+                fatal_error()
+                    << "Class-default 'cell' element is empty, but is version "
+                    << version
+                    << " where version 5 was expected."
+                    << LMI_FLUSH
+                    ;
+                }
+            }
+        else
+            {
+            *i >> temp;
+            }
         class_parms_.push_back(temp);
         if(class_parms_.size() == number_of_classes)
             {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]