Mailing List Archive

svn commit: r329710 - in /spamassassin/trunk/masses/rule-qa: automc/ruleqa.cgi rule-hits-over-time
Author: jm
Date: Sun Oct 30 18:35:37 2005
New Revision: 329710

URL: http://svn.apache.org/viewcvs?rev=329710&view=rev
Log:
some error-handling for empty logfiles

Modified:
spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi
spamassassin/trunk/masses/rule-qa/rule-hits-over-time

Modified: spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi?rev=329710&r1=329709&r2=329710&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi (original)
+++ spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi Sun Oct 30 18:35:37 2005
@@ -457,7 +457,7 @@
my ($filename, $strdate) = @_;
read_freqs_file($filename);

- if ($key eq 'DETAILS.new') {
+ if ($filename eq 'DETAILS.new') {
# report which sets we used
summarise_head($freqs_head{$key}, $filename, $strdate, $rule);
}

Modified: spamassassin/trunk/masses/rule-qa/rule-hits-over-time
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/rule-hits-over-time?rev=329710&r1=329709&r2=329710&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/rule-hits-over-time (original)
+++ spamassassin/trunk/masses/rule-qa/rule-hits-over-time Sun Oct 30 18:35:37 2005
@@ -157,18 +157,13 @@
my $file01 = GD::Image->newFromPngData($graph_png_data{"file01"}, 1);
my $file02 = GD::Image->newFromPngData($graph_png_data{"file02"}, 1);

- # I thought this might work around the "black background" issue,
- # but it doesn't :(
- # my $white = $both->colorAllocate(255,255,255);
- # $both->filledRectangle(0, 0, $graph_x, 15 + ($graph_y * 2), $white);
-
- $both->copy($file01, 0, 5, 0, 0, $graph_x-1, $graph_y-1);
- $both->copy($file02, 0, 10 + $graph_y, 0, 0, $graph_x-1, $graph_y-1);
-
- # $both->copyResampled($file01, 0, 5, 0, 0,
- # $graph_x/2, $graph_y/2, $graph_x-1, $graph_y-1);
- # $both->copyResampled($file02, 0, 10 + $graph_y, 0, 0,
- # $graph_x/2, $graph_y/2, $graph_x-1, $graph_y-1);
+ if (!$file01 || !$file02) {
+ warn "bad input. leaving graph blank";
+ }
+ else {
+ $both->copy($file01, 0, 5, 0, 0, $graph_x-1, $graph_y-1);
+ $both->copy($file02, 0, 10 + $graph_y, 0, 0, $graph_x-1, $graph_y-1);
+ }

if ($opt_cgi) {
use CGI qw(:standard);
@@ -343,9 +338,14 @@
if (!$opt_text)
{
open (DATA, ">$tmpdir/plot.data") or die;
- foreach my $line (@{$graph_data}) {
- my $tt = shift @$line;
- print DATA fmt_time_t($tt)," ",join(' ', @$line),"\n";
+ if (@{$graph_data}) {
+ foreach my $line (@{$graph_data}) {
+ my $tt = shift @$line;
+ print DATA fmt_time_t($tt)," ",join(' ', @$line),"\n";
+ }
+ } else {
+ # a fake datapoint so gnuplot doesn't puke on us
+ print DATA fmt_time_t(0)," 0 0\n";
}
close DATA or die;