From 0e33a2671133ea0bf268ff443ec3255f61b02640 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 16 Jan 2013 09:39:56 -0500 Subject: [PATCH] Avoid CStoreEditor failures on missing log-protect When the log_protect configuration chunk is not present in opensrf_core.xml, gracefully move on without it. This prevents errors like: Can't call method \"shared\" on an undefined value at /usr/local/share/perl/5.10.1/OpenILS/Utils/CStoreEditor.pm line 646. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm index 23559e0ce4..0a706489a6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm @@ -642,14 +642,18 @@ sub log_activity { my $str = "$type.$action"; if ($arg) { - - my $redact = $OpenSRF::Application::shared_conf->shared->log_protect; - if (ref($redact) eq 'ARRAY' and grep { $method =~ /^$_/ } @{$redact}) { - - # when API calls are marked as log-protect, avoid - # dumping the param object to the activity log. - $str .= " **DETAILS REDACTED**"; - + + my $redact; + + if ($OpenSRF::Application::shared_conf and + $OpenSRF::Application::shared_conf->shared and + $redact = $OpenSRF::Application::shared_conf->shared->log_protect and + ref($redact) eq 'ARRAY' and + grep { $method =~ /^$_/ } @{$redact}) { + + # when API calls are marked as log-protect, avoid + # dumping the param object to the activity log. + $str .= " **DETAILS REDACTED**"; } else { $str .= _prop_string($arg); -- 2.11.0