[open-ils-commits] [GIT] Evergreen ILS branch master updated. dce8be16c399e8fe61c29c07c5b4dc85139db72e

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, master has been updated
       via  dce8be16c399e8fe61c29c07c5b4dc85139db72e (commit)
      from  1708f88f5f87bf895469725d631192239e22fd58 (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 dce8be16c399e8fe61c29c07c5b4dc85139db72e
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