lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 3b168ba 2/3: Use warning() + alarum() for sch


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 3b168ba 2/3: Use warning() + alarum() for schema validation failure
Date: Thu, 19 Jul 2018 13:07:01 -0400 (EDT)

branch: master
commit 3b168baaeb998c332ba03b0a0c682a62d9b84f85
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use warning() + alarum() for schema validation failure
    
    Combined the beneficial aspects of two different diagnostic facilities
    for reporting schema validation failures.
    
    warning() uses wxMessageBox(), which does not necessarily work during
    lmi startup or shutdown, and has been observed to segfault with
    extremely long strings, such as schema validation might emit (see
      https://savannah.nongnu.org/bugs/?20240
    and the code removed 20180213T1240Z by commit e3c3d922).
    
    alarum() uses a native messagebox for msw, in a way that should never
    segfault, but is more primitive than the wx function: it's not
    scrollable, and with 'wine' in particular it simply fails to display a
    four-hundred-line schema-validation message, showing only an "Error"
    title, a red "X" icon, and an "OK" button.
---
 multiple_cell_document.cpp | 3 ++-
 single_cell_document.cpp   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/multiple_cell_document.cpp b/multiple_cell_document.cpp
index 64e68a5..c6a0bee 100644
--- a/multiple_cell_document.cpp
+++ b/multiple_cell_document.cpp
@@ -448,13 +448,14 @@ void multiple_cell_document::validate_with_xsd_schema
     xml::error_messages errors;
     if(!schema.validate(cell_sorter().apply(xml), errors))
         {
-        alarum()
+        warning()
             << "Validation with schema '"
             << xsd
             << "' failed.\n\n"
             << errors.print()
             << std::flush
             ;
+        alarum() << "Invalid input file." << LMI_FLUSH;
         }
 }
 
diff --git a/single_cell_document.cpp b/single_cell_document.cpp
index 044afb1..cd048fd 100644
--- a/single_cell_document.cpp
+++ b/single_cell_document.cpp
@@ -193,13 +193,14 @@ void single_cell_document::validate_with_xsd_schema
     xml::error_messages errors;
     if(!schema.validate(cell_sorter().apply(xml), errors))
         {
-        alarum()
+        warning()
             << "Validation with schema '"
             << xsd
             << "' failed.\n\n"
             << errors.print()
             << std::flush
             ;
+        alarum() << "Invalid input file." << LMI_FLUSH;
         }
 }
 



reply via email to

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