From 20e49b51d6f09f65f08573442b865e4f863bf904 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 26 Jan 2012 16:04:02 -0800 Subject: [PATCH] Try to trap errors while loading classes. Fixes bug #12321. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Group.pm | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index fc6d7724e..b06822b30 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.10.25 +- fixed #12321: Error while deleting a group. 7.10.24 - fixed #12318: asset error causes asset manager to fail diff --git a/lib/WebGUI/Group.pm b/lib/WebGUI/Group.pm index 0be656a5b..3ceb8b4fa 100644 --- a/lib/WebGUI/Group.pm +++ b/lib/WebGUI/Group.pm @@ -1625,8 +1625,11 @@ sub resetGroupFields { ##Note, I did assets in SQL instead of using the API because you would have to ##instanciate every version of the asset that used the group. This should be much quicker ASSET: foreach my $assetClass ($db->buildArray('SELECT DISTINCT className FROM asset')) { - next ASSET unless $db->quickScalar( "SELECT COUNT(*) FROM asset WHERE className=?", [$assetClass] ); - my $definition = WebGUI::Pluggable::instanciate($assetClass, 'definition', [$session]); + my $definition = eval { WebGUI::Pluggable::instanciate($assetClass, 'definition', [$session]); }; + if ($@) { + $session->log->error("Unable to load className: " . $className . " when looking for asset definitions: " . $@); + next ASSET; + } SUBDEF: foreach my $subdef (@{ $definition }) { next SUBDEF if exists $tableCache->{$subdef->{tableName}}; PROP: while (my ($fieldName, $properties) = each %{ $subdef->{properties} }) {