You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2008/09/25 13:43:47 UTC

svn commit: r698930 - /spamassassin/trunk/lib/Mail/SpamAssassin/AICache.pm

Author: mmartinec
Date: Thu Sep 25 04:43:46 2008
New Revision: 698930

URL: http://svn.apache.org/viewvc?rev=698930&view=rev
Log:
Relax reactions to errors in AICache.pm

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/AICache.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/AICache.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/AICache.pm?rev=698930&r1=698929&r2=698930&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/AICache.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/AICache.pm Thu Sep 25 04:43:46 2008
@@ -38,6 +38,7 @@
 use File::Spec;
 use File::Path;
 use File::Basename;
+use Mail::SpamAssassin::Logger;
 
 use strict;
 use warnings;
@@ -71,7 +72,7 @@
                 '.spamassassin_cache');
 
     my @stat = stat($self->{cache_file});
-    @stat  or warn "AIcache: no access to $self->{cache_file}: $!";
+    @stat  or dbg("AIcache: no access to %s: %s", $self->{cache_file}, $!);
     $self->{cache_mtime} = $stat[9] || 0;
   }
   else {
@@ -82,13 +83,13 @@
                 join('_', '.spamassassin_cache', $self->{type}, $split[2]));
 
     my @stat = stat($self->{cache_file});
-    @stat  or warn "AIcache: no access to $self->{cache_file}: $!";
+    @stat  or dbg("AIcache: no access to %s: %s", $self->{cache_file}, $!);
     $self->{cache_mtime} = $stat[9] || 0;
 
     # for mbox and mbx, verify whether mtime on cache file is >= mtime of
     # messages file.  if it is, use it, otherwise don't.
     @stat = stat($self->{path});
-    @stat  or warn "AIcache: no access to $self->{path}: $!";
+    @stat  or dbg("AIcache: no access to %s: %s", $self->{path}, $!);
     if ($stat[9] > $self->{cache_mtime}) {
       $use_cache = 0;
     }
@@ -99,14 +100,14 @@
   if (!$use_cache) {
     # not in use
   } elsif (!open(CACHE, $self->{cache_file})) {
-    die "cannot open AI cache file (".$self->{cache_file}."): $!";
+    die dbg("cannot open AI cache file (%s): %s", $self->{cache_file},$!);
   } else {
     for ($!=0; defined($_=<CACHE>); $!=0) {
       my($k,$v) = split(/\t/, $_);
       next unless (defined $k && defined $v);
       $self->{cache}->{$k} = $v;
     }
-    defined $_ || $!==0  or die "error reading from AI cache file: $!";
+    defined $_ || $!==0  or warn "error reading from AI cache file: $!";
     close CACHE
       or die "error closing AI cache file (".$self->{cache_file}."): $!";
   }
@@ -180,9 +181,9 @@
     }
     else {
       print CACHE $towrite
-        or die "error writing to AI cache file: $!";
+        or warn "error writing to AI cache file: $!";
       close CACHE
-        or die "error closing AI cache file (".$self->{cache_file}."): $!";
+        or warn "error closing AI cache file (".$self->{cache_file}."): $!";
     }
   }