From: Bill Erickson <berick@esilibrary.com>
Date: Wed, 16 Jan 2013 14:39:56 +0000 (-0500)
Subject: Avoid CStoreEditor failures on missing log-protect
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0e33a2671133ea0bf268ff443ec3255f61b02640;p=contrib%2FConifer.git

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 <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
---

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);