1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-20 10:17:16 +01:00

Catch exception inside preprocessor loop so that loop continues after

error (for unit tests).  Also make sure to set ".loaded" variable before
calling loadFromSource so that if an exception happens we won't try to
load it again later.

Fixes #2542.
This commit is contained in:
Theron Tock 2011-06-29 14:28:33 -07:00
parent 57de77b341
commit 2ee4869fac
2 changed files with 22 additions and 16 deletions

View File

@ -4,6 +4,11 @@
validate the drop the same we we validate in dragMove to make sure
the drop is valid.
* Fixed #2542. Catch exception inside preprocessor loop so that
loop continues after error (for unit tests). Also make sure to
set ".loaded" variable before calling loadFromSource so that if an
exception happens we won't try to load it again later.
2011-06-27 theron <theron@netcitadel.com>
* Fixed #2530, where adding a subfolder opens the parent folder in

View File

@ -71,11 +71,9 @@ Preprocessor::Preprocessor(FWObjectDatabase *_db,
void Preprocessor::convertObject(FWObject *obj)
{
MultiAddress *adt = MultiAddress::cast(obj);
if (adt!=NULL && adt->isCompileTime() &&
obj->getInt(".loaded") != infinite_recursion_breaker)
if (adt!=NULL && adt->isCompileTime())
{
adt->loadFromSource(ipv6, inTestMode());
obj->setInt(".loaded", infinite_recursion_breaker);
}
}
@ -107,7 +105,16 @@ void Preprocessor::findMultiAddressObjectsUsedInRules(FWObject *top)
else
{
FWObject *obj_ptr = FWReference::getObject(obj);
convertObject(obj_ptr);
if (obj_ptr->getInt(".loaded") == infinite_recursion_breaker)
continue;
obj_ptr->setInt(".loaded", infinite_recursion_breaker);
try
{
convertObject(obj_ptr);
} catch (FWException &ex) {
abort(ex.toString());
}
// Note that MultiAddress inherits ObjectGroup
if (Group::cast(obj_ptr))
@ -127,20 +134,14 @@ void Preprocessor::compile()
infinite_recursion_breaker++;
FWObject *rule_copy = NULL;
try
if (single_rule_mode)
{
if (single_rule_mode)
{
rule_copy = dbcopy->findInIndex(single_rule_compile_rule->getId());
findMultiAddressObjectsUsedInRules(rule_copy);
} else
{
FWObject *fwcopy = dbcopy->findInIndex(fw->getId());
findMultiAddressObjectsUsedInRules(fwcopy);
}
} catch (FWException &ex)
rule_copy = dbcopy->findInIndex(single_rule_compile_rule->getId());
findMultiAddressObjectsUsedInRules(rule_copy);
} else
{
abort(ex.toString());
FWObject *fwcopy = dbcopy->findInIndex(fw->getId());
findMultiAddressObjectsUsedInRules(fwcopy);
}
/* resolving MultiAddress objects */
// convertObjectsRecursively(dbcopy);