diff --git a/build_num b/build_num index 1a486989c..493fe0164 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 479 +#define BUILD_NUM 480 diff --git a/doc/ChangeLog b/doc/ChangeLog index 64afbf071..40f4688f9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,12 @@ +2008-08-21 Vadim Kurland + + * ProjectPanel_file_ops.cpp (ProjectPanel::load): truncating very + long error messages that happen when GUI tries to load broken .fwb + file. These error messages contain complete output of the XML + parser which can be very long and does not fit in the normal error + dialog. Message will be cut off at 1000 characters which is enough + to see the topmost part of the parser output. + 2008-08-20 vadim * ObjectTreeView.cpp (ObjectTreeView::ObjectTreeView): Fixed GUI diff --git a/qmake.inc b/qmake.inc index 1852fa3e9..a6121cd74 100644 --- a/qmake.inc +++ b/qmake.inc @@ -11,15 +11,15 @@ SO_VERSION = @LIBFWBUILDER_SOLIB_VERSION@ DEFINES += $$(DEFINES) LANGUAGE = C++ UI_DIR = ui -MANDIR = /home/vadim/src/fwb3/install_root/share/man/ -DOCDIR = /home/vadim/src/fwb3/install_root/share/doc/fwbuilder-3.0.0 +MANDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/man/ +DOCDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0 HAVE_ANTLR_RUNTIME = 1 HAVE_EXTERNAL_ANTLR = 0 unix { - ANTLR_INCLUDEPATH = /home/vadim/src/fwb3/source/fwbuilder/src/ - ANTLR_LIBS = /home/vadim/src/fwb3/source/fwbuilder/src/antlr/libantlr.a + ANTLR_INCLUDEPATH = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/ + ANTLR_LIBS = /home/vadim/src/fwb3-branch-v3/source/fwbuilder/src/antlr/libantlr.a FWBPARSER_LIB = ../parsers/libfwbparser.a } @@ -30,32 +30,32 @@ unix { MOC_DIR = .moc OBJECTS_DIR = .obj - PREFIX = /home/vadim/src/fwb3/install_root + PREFIX = /home/vadim/src/fwb3-branch-v3/install_root exec_prefix = @EXEC_PREFIX@ DESTDIR = - ICONSDIR = /home/vadim/src/fwb3/install_root/share//icons/hicolor/ + ICONSDIR = /home/vadim/src/fwb3-branch-v3/install_root/share//icons/hicolor/ - INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /home/vadim/src/fwb3/install_root/include/ /home/vadim/src/fwb3/install_root/include/fwb-3 /usr/include/libxml2 + INCLUDEPATH += .. ../.. $$(INCLUDEPATH) /home/vadim/src/fwb3-branch-v3/install_root/include/ /home/vadim/src/fwb3-branch-v3/install_root/include/fwb-3 /usr/include/libxml2 - LIBS_FWCOMPILER = -L/home/vadim/src/fwb3/install_root/lib -Wl,-Bsymbolic-functions -pthread -lfwcompiler -lfwbuilder -lxslt -lxml2 -lnetsnmp - LIBS_FWBUILDER = -L/home/vadim/src/fwb3/install_root/lib -Wl,-Bsymbolic-functions -pthread -lfwbuilder -lxslt -lxml2 -lnetsnmp + LIBS_FWCOMPILER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwcompiler -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap + LIBS_FWBUILDER = -L/home/vadim/src/fwb3-branch-v3/install_root/lib -pthread -lfwbuilder -lxslt -lxml2 -lnetsnmp -lm -lwrap target.path = $$PREFIX/bin dtd.path = @TEMPLATE_DIR@/ migration.path = @TEMPLATE_DIR@/migration - doc.path = /home/vadim/src/fwb3/install_root/share/doc/fwbuilder-3.0.0 - datadir.path = /home/vadim/src/fwb3/install_root/share/ + doc.path = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0 + datadir.path = /home/vadim/src/fwb3-branch-v3/install_root/share/ # win32:target.path = $$PREFIX/ # unix:target.path = $$PREFIX/share/fwbuilder/ # macx:target.path = $$PREFIX/ - res.path = /home/vadim/src/fwb3/install_root/share/fwbuilder-3.0.0 - res_os.path = /home/vadim/src/fwb3/install_root/share/fwbuilder-3.0.0/os/ - res_platform.path = /home/vadim/src/fwb3/install_root/share/fwbuilder-3.0.0/platform/ - res_help.path = /home/vadim/src/fwb3/install_root/share/fwbuilder-3.0.0/help/ - res_desktop.path = /home/vadim/src/fwb3/install_root/share//applications/ + res.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0 + res_os.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/os/ + res_platform.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/platform/ + res_help.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/help/ + res_desktop.path = /home/vadim/src/fwb3-branch-v3/install_root/share//applications/ INSTALLS += res INSTALLS += res_os diff --git a/src/gui/ProjectPanel_file_ops.cpp b/src/gui/ProjectPanel_file_ops.cpp index 27603fc76..f87db6e28 100644 --- a/src/gui/ProjectPanel_file_ops.cpp +++ b/src/gui/ProjectPanel_file_ops.cpp @@ -67,6 +67,7 @@ #include +#define LONG_ERROR_CUTOFF 1024 using namespace Ui; using namespace libfwbuilder; @@ -524,7 +525,7 @@ void ProjectPanel::fileCompare() if (dobj) db1->remove(dobj, false); } catch(FWException &ex) { - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", tr("Error loading file %1:\n%2"). arg(fname1).arg(ex.toString().c_str()), @@ -543,7 +544,7 @@ void ProjectPanel::fileCompare() if (dobj) db2->remove(dobj, false); } catch(FWException &ex) { - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", tr("Error loading file %1:\n%2"). arg(fname2).arg(ex.toString().c_str()), @@ -615,7 +616,7 @@ void ProjectPanel::fileCompare() } catch(FWException &ex) { - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", tr("Unexpected error comparing files %1 and %2:\n%3"). arg(fname1).arg(fname2).arg(ex.toString().c_str()), @@ -845,7 +846,7 @@ void ProjectPanel::exportLibraryTo(QString fname,list &selectedLibs, if (access( fname.toLatin1().constData(), W_OK)!=0 && errno==EACCES) err=QObject::tr("File is read-only"); - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", QObject::tr("Error saving file %1: %2") .arg(fname).arg(err), @@ -942,11 +943,17 @@ void ProjectPanel::loadLibrary(const string &libfpath) } catch(FWException &ex) { - QMessageBox::warning( + QString error_txt = ex.toString().c_str(); + if (error_txt.length() > LONG_ERROR_CUTOFF) + { + error_txt.truncate(LONG_ERROR_CUTOFF); + error_txt += "\n\n" + tr("(Long error message was truncated)"); + } + QMessageBox::critical( this,"Firewall Builder", tr("The program encountered error trying to load file %1.\n" "The file has not been loaded. Error:\n%2"). - arg(libfpath.c_str()).arg(ex.toString().c_str()), + arg(libfpath.c_str()).arg(error_txt), tr("&Continue"), QString::null,QString::null, 0, 1 ); } @@ -1010,7 +1017,7 @@ void ProjectPanel::load(QWidget*) } catch(FWException &ex) { - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", tr("Error loading file:\n%1").arg(ex.toString().c_str()), tr("&Continue"), QString::null,QString::null, @@ -1205,32 +1212,45 @@ void ProjectPanel::load(QWidget*, } catch(FWException &ex) { - string trans = ex.getProperties()["failed_transformation"]; - string elem = ex.getProperties()["failed_element"]; + QString trans = ex.getProperties()["failed_transformation"].c_str(); + QString elem = ex.getProperties()["failed_element"].c_str(); - if(!trans.empty() || !elem.empty()) + if(!trans.isEmpty() || !elem.isEmpty()) { QString msg = tr("Exception: %1").arg(ex.toString().c_str()); - if (!trans.empty()) - msg+="\n"+tr("Failed transformation : %1").arg(trans.c_str()); - if (!elem.empty()) - msg+="\n"+tr("XML element : %1").arg(elem.c_str()); - - QMessageBox::warning( - this,"Firewall Builder", - tr("The program encountered error trying to load data file.\n" - "The file has not been loaded. Error:\n%1").arg(msg), - tr("&Continue"), QString::null,QString::null, - 0, 1 ); + if (!trans.isEmpty()) + { + trans.truncate(LONG_ERROR_CUTOFF); + msg+="\n"+tr("Failed transformation : %1").arg(trans); + } + if (!elem.isEmpty()) + { + elem.truncate(LONG_ERROR_CUTOFF); + msg+="\n"+tr("XML element : %1").arg(elem); + } + QMessageBox::critical( + this,"Firewall Builder", + tr("The program encountered error trying to load data file.\n" + "The file has not been loaded. Error:\n%1").arg(msg), + tr("&Continue"), QString::null,QString::null, + 0, 1 ); } else - QMessageBox::warning( - this,"Firewall Builder", - tr("The program encountered error trying to load data file.\n" - "The file has not been loaded. Error:\n%1").arg( - ex.toString().c_str()), - tr("&Continue"), QString::null,QString::null, - 0, 1 ); + { + QString error_txt = ex.toString().c_str(); + if (error_txt.length() > LONG_ERROR_CUTOFF) + { + error_txt.truncate(LONG_ERROR_CUTOFF); + error_txt += "\n\n" + tr("(Long error message was truncated)"); + } + QMessageBox::critical( + this,"Firewall Builder", + tr("The program encountered error trying to load data file.\n" + "The file has not been loaded. Error:\n%1").arg( + error_txt), + tr("&Continue"), QString::null,QString::null, + 0, 1 ); + } load(this); return; } @@ -1498,31 +1518,45 @@ void ProjectPanel::load(QWidget*, RCS *_rcs) } catch(FWException &ex) { - string trans = ex.getProperties()["failed_transformation"]; - string elem = ex.getProperties()["failed_element"]; + QString trans = ex.getProperties()["failed_transformation"].c_str(); + QString elem = ex.getProperties()["failed_element"].c_str(); - if(!trans.empty() || !elem.empty()) + if(!trans.isEmpty() || !elem.isEmpty()) { QString msg = tr("Exception: %1").arg(ex.toString().c_str()); - if (!trans.empty()) - msg+="\n"+tr("Failed transformation : %1").arg(trans.c_str()); - if (!elem.empty()) - msg+="\n"+tr("XML element : %1").arg(elem.c_str()); - - QMessageBox::warning( + if (!trans.isEmpty()) + { + trans.truncate(LONG_ERROR_CUTOFF); + msg+="\n"+tr("Failed transformation : %1").arg(trans); + } + if (!elem.isEmpty()) + { + elem.truncate(LONG_ERROR_CUTOFF); + msg+="\n"+tr("XML element : %1").arg(elem); + } + QMessageBox::critical( this,"Firewall Builder", tr("The program encountered error trying to load data file.\n" "The file has not been loaded. Error:\n%1").arg(msg), tr("&Continue"), QString::null,QString::null, 0, 1 ); } else - QMessageBox::warning( + { + QString error_txt = ex.toString().c_str(); + if (error_txt.length() > LONG_ERROR_CUTOFF) + { + error_txt.truncate(LONG_ERROR_CUTOFF); + error_txt += "\n\n" + tr("(Long error message was truncated)"); + } + + QMessageBox::critical( this,"Firewall Builder", tr("The program encountered error trying to load data file.\n" "The file has not been loaded. Error:\n%1").arg( - ex.toString().c_str()), + error_txt), tr("&Continue"), QString::null,QString::null, 0, 1 ); + } // load standard objects so the window does not remain empty load(this); return; @@ -1597,7 +1631,7 @@ bool ProjectPanel::checkin(bool unlock) } catch (FWException &ex) { - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", tr("Error checking in file %1:\n%2") .arg(rcs->getFileName()).arg(ex.toString().c_str()), @@ -1687,7 +1721,7 @@ void ProjectPanel::save() else err=ex.toString().c_str(); - QMessageBox::warning( + QMessageBox::critical( this,"Firewall Builder", tr("Error saving file %1: %2") .arg(rcs->getFileName()).arg(err),