[open-ils-commits] [GIT] Evergreen ILS branch rel_2_6 updated. 885c98e1c38b8c3fb09d7ce7ab3dbafa0cfb0b21

Evergreen Git git at git.evergreen-ils.org
Thu Sep 18 16:22:07 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_6 has been updated
       via  885c98e1c38b8c3fb09d7ce7ab3dbafa0cfb0b21 (commit)
      from  57164aaab9ad6d44bc3c8ab4caa740e2c4571f05 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 885c98e1c38b8c3fb09d7ce7ab3dbafa0cfb0b21
Author: Jason Stephenson <jstephenson at mvlc.org>
Date:   Wed Jul 30 09:26:38 2014 -0400

    LP 1350345: marc_export blows up on bad records.
    
    Add some eval blocks around calls to MARC::Record->as_usmarc and
    MARC::Record->as_xml_record to trap errors in bibliograpic and
    authority records.
    
    If MARC::Record reports an error, print the record id and the
    error message and continue the export.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/support-scripts/marc_export.in b/Open-ILS/src/support-scripts/marc_export.in
index 7f24a3d..348c4b3 100755
--- a/Open-ILS/src/support-scripts/marc_export.in
+++ b/Open-ILS/src/support-scripts/marc_export.in
@@ -509,10 +509,24 @@ sub next {
             }
         }
         if ($Marque::config->option_value('format') eq 'XML') {
-            $output = $marc->as_xml_record;
-            $output =~ s/^<\?.+?\?>$//mo;
+            eval {
+                $output = $marc->as_xml_record;
+                $output =~ s/^<\?.+?\?>$//mo;
+            };
+            if ($@) {
+                print STDERR "Error in bibliograpic record " . $r->id() . "\n";
+                print STDERR "$@\n";
+                return $self->next();
+            }
         } else {
-            $output = $marc->as_usmarc;
+            eval {
+                $output = $marc->as_usmarc;
+            };
+            if ($@) {
+                print STDERR "Error in bibliograpic record " . $r->id() . "\n";
+                print STDERR "$@\n";
+                return $self->next();
+            }
         }
     }
     return $output;
@@ -755,10 +769,24 @@ sub next {
                 }
             }
             if ($Marque::config->option_value('format') eq 'XML') {
-                $output = $r->as_xml_record;
-                $output =~ s/^<\?.+?\?>$//mo;
+                eval {
+                    $output = $r->as_xml_record;
+                    $output =~ s/^<\?.+?\?>$//mo;
+                };
+                if ($@) {
+                    print STDERR "Error in authority record " . $r->id() . "\n";
+                    print STDERR "$@\n";
+                    return $self->next();
+                }
             } else {
-                $output = $r->as_usmarc;
+                eval {
+                    $output = $r->as_usmarc;
+                };
+                if ($@) {
+                    print STDERR "Error in authority record " . $r->id() . "\n";
+                    print STDERR "$@\n";
+                    return $self->next();
+                }
             }
         }
     }

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/support-scripts/marc_export.in |   40 +++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list