|
From: <sar...@us...> - 2013-07-25 11:36:15
|
Revision: 18265
http://sourceforge.net/p/sbml/code/18265
Author: sarahkeating
Date: 2013-07-25 11:36:12 +0000 (Thu, 25 Jul 2013)
Log Message:
-----------
if we log errors from comp validation we want the message about numbering not being consistent; however we should not log this message unless we are actually logging other errors from comp
Modified Paths:
--------------
trunk/libsbml/src/sbml/packages/comp/extension/CompSBMLDocumentPlugin.cpp
Modified: trunk/libsbml/src/sbml/packages/comp/extension/CompSBMLDocumentPlugin.cpp
===================================================================
--- trunk/libsbml/src/sbml/packages/comp/extension/CompSBMLDocumentPlugin.cpp 2013-07-25 11:34:38 UTC (rev 18264)
+++ trunk/libsbml/src/sbml/packages/comp/extension/CompSBMLDocumentPlugin.cpp 2013-07-25 11:36:12 UTC (rev 18265)
@@ -706,7 +706,7 @@
/*
* note number of errors before we do anything here
* so we get the right number after
- * total_errors here means teh total number logged by this function
+ * total_errors here means the total number logged by this function
*/
unsigned int errorsB4 = doc->getErrorLog()->getNumErrors();
@@ -714,9 +714,11 @@
SBMLErrorLog *log = doc->getErrorLog();
total_errors = log->getNumErrors() - errorsB4;
- /* log a message to say not to trust line numbers */
- log->logPackageError("comp", CompLineNumbersUnreliable,
- getLevel(), getVersion(), getPackageVersion());
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * use boolean to ensure we only log it once
+ */
+ bool lineNumMessageLogged = false;
unsigned char applicableValidators = doc->getApplicableValidators();
@@ -734,7 +736,20 @@
total_errors += nerrors;
if (nerrors > 0)
{
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * and only do it once
+ */
+ if (lineNumMessageLogged == false)
+ {
+ log->logPackageError("comp", CompLineNumbersUnreliable,
+ getLevel(), getVersion(), getPackageVersion());
+ total_errors++;
+ lineNumMessageLogged = true;
+ }
+
log->add(id_validator.getFailures() );
+
/* only want to bail if errors not warnings */
if (log->getNumFailsWithSeverity(LIBSBML_SEV_ERROR) > 0)
{
@@ -750,7 +765,20 @@
total_errors += nerrors;
if (nerrors > 0)
{
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * and only do it once
+ */
+ if (lineNumMessageLogged == false)
+ {
+ log->logPackageError("comp", CompLineNumbersUnreliable,
+ getLevel(), getVersion(), getPackageVersion());
+ total_errors++;
+ lineNumMessageLogged = true;
+ }
+
log->add( validator.getFailures() );
+
/* only want to bail if errors not warnings */
if (log->getNumFailsWithSeverity(LIBSBML_SEV_ERROR) > 0)
{
@@ -786,6 +814,18 @@
total_errors += nerrors;
if (nerrors > 0)
{
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * and only do it once
+ */
+ if (lineNumMessageLogged == false)
+ {
+ log->logPackageError("comp", CompLineNumbersUnreliable,
+ getLevel(), getVersion(), getPackageVersion());
+ total_errors++;
+ lineNumMessageLogged = true;
+ }
+
for (unsigned int n = 0; n < nerrors; n++)
{
log->add( *(dummyDoc->getErrorLog()->getError(n)) );
@@ -830,6 +870,18 @@
if (dummyDoc->getErrorLog()->
getNumFailsWithSeverity(LIBSBML_SEV_ERROR) > 0)
{
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * and only do it once
+ */
+ if (lineNumMessageLogged == false)
+ {
+ log->logPackageError("comp", CompLineNumbersUnreliable,
+ getLevel(), getVersion(), getPackageVersion());
+ total_errors++;
+ lineNumMessageLogged = true;
+ }
+
std::string message = "Errors that follow relate to the flattened ";
message += "document produced using the CompFlatteningConverter.";
log->logPackageError("comp", CompFlatModelNotValid, getLevel(),
@@ -839,6 +891,18 @@
total_errors += nerrors;
if (nerrors > 0)
{
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * and only do it once
+ */
+ if (lineNumMessageLogged == false)
+ {
+ log->logPackageError("comp", CompLineNumbersUnreliable,
+ getLevel(), getVersion(), getPackageVersion());
+ total_errors++;
+ lineNumMessageLogged = true;
+ }
+
for (unsigned int n = 0; n < nerrors; n++)
{
log->add( *(dummyDoc->getErrorLog()->getError(n)) );
@@ -851,6 +915,18 @@
total_errors += nerrors;
if (nerrors > 0)
{
+ /* log a message to say not to trust line numbers
+ * but only do this if we are actually logging errors
+ * and only do it once
+ */
+ if (lineNumMessageLogged == false)
+ {
+ log->logPackageError("comp", CompLineNumbersUnreliable,
+ getLevel(), getVersion(), getPackageVersion());
+ total_errors++;
+ lineNumMessageLogged = true;
+ }
+
for (unsigned int n = 0; n < nerrors; n++)
{
log->add( *(dummyDoc->getErrorLog()->getError(n)) );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|