Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Ico Doornekamp <sup@zevv.nl>
To: William Morgan <wmorgan-sup@masanjin.net>
Cc: sup-talk <sup-talk@rubyforge.org>, sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-talk] [sup-devel] sup v2 progress report
Date: Thu, 14 Apr 2011 09:39:44 +0200	[thread overview]
Message-ID: <1302766464-sup-8275@pruts.nl> (raw)
In-Reply-To: <1301257195-sup-9486@masanjin.net>

* On Sun Mar 27 22:41:59 +0200 2011, William Morgan wrote:
 
> Heliotrope, the server component, is close to ready for a version 1 release.
> You can find it at https://github.com/wmorgan/heliotrope/.

Heliotrope (Actually Time.parse()) crashes on some illegaly formatted dates:

  /usr/lib/ruby/1.9.1/time.rb:137:in `apply_offset': undefined method `<' for nil:NilClass (NoMethodError)
  	from /usr/lib/ruby/1.9.1/time.rb:197:in `make_time'
  	from /usr/lib/ruby/1.9.1/time.rb:261:in `parse'
  	from /home/ico/external/heliotrope/lib/heliotrope/message.rb:27:in `parse!'
  	from bin/heliotrope-add:108:in `<main>'

The date of the message was "Wed, 7  2005 22:55: 1  -0180".

Fixed by adding a NoMethodError catch:

diff --git a/lib/heliotrope/message.rb b/lib/heliotrope/message.rb
index 1682062..d63e411 100644
--- a/lib/heliotrope/message.rb
+++ b/lib/heliotrope/message.rb
@@ -23,7 +23,7 @@ class Message
     @from = Person.from_string decode_header(validate_field(:from, @m.header["from"]))
     @date = begin
       Time.parse(validate_field(:date, @m.header["date"])).to_i
-    rescue ArgumentError
+    rescue ArgumentError, NoMethodError
       #puts "warning: invalid date field #{@m.header['date']}"
       Time.at 0
     end


-- 
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


  parent reply	other threads:[~2011-04-14  7:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27 20:41 William Morgan
2011-03-28  4:14 ` [sup-talk] " Matthieu Rakotojaona
2011-03-28 14:57   ` David J. Hamilton
2011-03-28 22:57   ` William Morgan
2011-03-28 12:52 ` [sup-devel] " Nicolas Pouillard
2011-03-29  3:11   ` [sup-talk] " William Morgan
2011-03-29  4:00   ` William Morgan
2011-03-29 21:19     ` [sup-talk] " Nicolas Pouillard
2011-03-29 21:31       ` William Morgan
2011-03-28 14:21 ` [sup-talk] " Lincoln de Sousa
2011-03-29  3:12   ` William Morgan
2011-04-14  7:39 ` Ico Doornekamp [this message]
2011-04-14  7:51 ` [sup-devel] " Ico Doornekamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302766464-sup-8275@pruts.nl \
    --to=sup@zevv.nl \
    --cc=sup-devel@rubyforge.org \
    --cc=sup-talk@rubyforge.org \
    --cc=wmorgan-sup@masanjin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox