1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 04:07:55 +01:00

see #1931 added newlines between "PArser error" and other parts of the combined error message

This commit is contained in:
Vadim Kurland 2011-02-09 16:13:09 -08:00
parent 02ae23b197
commit 16a51265ec
4 changed files with 33 additions and 21 deletions

View File

@ -1709,8 +1709,9 @@ void DiscoveryDruid::updateLog()
FWException * ex=bop->get_latest_error();
if (ex!=NULL)
{
QMessageBox::critical(this,tr("Discovery error"), ex->toString().c_str());
//m_dialog->discoverylog->append(QString("\nLast exception: ")+ex->toString().c_str()+"\n");
QMessageBox::critical(this,
tr("Discovery error"),
ex->toString().c_str());
}
if (Objects.size()>0 || Networks.size()>0)
{
@ -1755,8 +1756,8 @@ void DiscoveryDruid::updateLog()
FWException * ex=bop->get_latest_error();
if (ex!=NULL)
{
QMessageBox::critical(this,tr("Discovery error"), ex->toString().c_str());
//m_dialog->discoverylog->append(QString("\nLast exception: ")+ex->toString().c_str()+"\n");
QMessageBox::critical(this, tr("Discovery error"),
ex->toString().c_str());
}
if (Objects.size()>0)
{
@ -1933,7 +1934,7 @@ int DiscoveryDruid::monitorOperation()
if (buf.endsWith('\n'))
buf = buf.left(buf.length() - 1);
m_dialog->discoverylog->append(buf);
m_dialog->discoverylog->insertPlainText(buf);
/*if (fwbdebug) qDebug("monitorOperation appending the following buf: (1)");
if (fwbdebug) qDebug(buf.toAscii().constData());
@ -1965,7 +1966,7 @@ int DiscoveryDruid::monitorOperation()
if (buf.endsWith('\n'))
buf = buf.left(buf.length() - 1);
m_dialog->discoverylog->append(buf);
m_dialog->discoverylog->insertPlainText(buf);
/*if (fwbdebug) qDebug("monitorOperation appending the following buf: (2)");
if (fwbdebug) qDebug(buf.toAscii().constData());
@ -2550,7 +2551,7 @@ HostsFileImport::HostsFileImport(const QString &f) :
void HostsFileImport::run()
{
*Log << "Discovery method:"
*Log << "Discovery method: "
<< "Read file in hosts format. \n";
map<InetAddr, vector<string> > reverse_hosts;
@ -2625,8 +2626,7 @@ ConfigImport::~ConfigImport()
void ConfigImport::run()
{
*Log << "Discovery method:"
<< "Import firewall configuration. \n";
*Log << "Discovery method: Import firewall configuration.\n";
std::istringstream instream(*buffer);
imp = NULL;

View File

@ -57,6 +57,7 @@ void IOSImporter::run()
//
QStringList err;
QString parser_err = QObject::tr("Parser error:\n");
std::ostringstream parser_debug;
IOSCfgLexer lexer(input);
@ -70,11 +71,11 @@ void IOSImporter::run()
parser.cfgfile();
} catch(ANTLR_USE_NAMESPACE(antlr)ANTLRException &e)
{
err << QObject::tr("Parser error:");
err << parser_err;
err << e.toString().c_str();
} catch(std::exception& e)
{
err << QObject::tr("Parser error:");
err << parser_err;
err << e.what();
}
@ -84,11 +85,12 @@ void IOSImporter::run()
if (countRules()==0) err << noRulesErrorMessage();
} else
{
err << QObject::tr("Parser error:");
err << parser_err;
err << noFirewallErrorMessage();
err << commonFailureErrorMessage();
}
if (!err.isEmpty()) throw ImporterException(err.join("\n").toStdString());
if (!err.isEmpty())
throw ImporterException(err.join("\n").toUtf8().constData());
}

View File

@ -110,16 +110,18 @@ void IPTImporter::run()
if (fwbdebug) parser.dbg = &std::cerr;
else parser.dbg = &parser_debug;
QString parser_err = QObject::tr("Parser error:\n");
try
{
parser.cfgfile();
} catch(ANTLR_USE_NAMESPACE(antlr)ANTLRException &e)
{
err << QObject::tr("Parser error:");
err << parser_err;
err << e.toString().c_str();
} catch(std::exception& e)
{
err << QObject::tr("Parser error:");
err << parser_err;
err << e.what();
}
@ -129,11 +131,12 @@ void IPTImporter::run()
if (countRules()==0) err << noRulesErrorMessage();
} else
{
err << QObject::tr("Parser error:");
err << parser_err;
err << noFirewallErrorMessage();
err << commonFailureErrorMessage();
}
if (!err.isEmpty()) throw ImporterException(err.join("\n").toStdString());
if (!err.isEmpty())
throw ImporterException(err.join("\n").toUtf8().constData());
}

View File

@ -1050,7 +1050,8 @@ void Importer::markCurrentRuleBad(const std::string &comment)
rule_comment += comment;
//current_rule->setComment(comment);
*logger << "Parser error: " << comment << "\n";
*logger << QObject::tr("Parser error:\n").toUtf8().constData()
<< comment << "\n";
error_counter++;
}
@ -1086,21 +1087,27 @@ QString Importer::noFirewallErrorMessage()
{
return QObject::tr(
"Could not find enough information in the data file "
"to create firewall object.");
"to create firewall object."
"\n\n"
);
}
QString Importer::noRulesErrorMessage()
{
return QObject::tr(
"Could not find enough information in the data file "
"to create any firewall rules.");
"to create any firewall rules."
"\n\n"
);
}
QString Importer::noInterfacesErrorMessage()
{
return QObject::tr(
"Could not find enough information in the data file "
"to create firewall interface objects.");
"to create firewall interface objects."
"\n\n"
);
}
/*