Someone report this...I've got to run an errand this evening...
-------- Original Message --------
Subject: JRuby DateTime strptime error
Date: Mon, 04 Jun 2007 18:18:20 -0400
From: Robert Wilson <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Dear Charles,
I think JRuby is a great project and I am really looking forward to
the 1.0 release. However, I came across a section of an existing
program today using the DateTime library that throws an error when
run with JRuby. As I am not really sure how to report the problem
through the codehaus page, I thought I would write to you directly.
I hope this is not a serious issue.
Best wishes,
Robert Wilson.
The error message is:
robert$ /usr/local/jruby-1.0.0RC3/bin/jruby ~/Desktop/strptime_test2.rb
/usr/local/jruby-1.0.0RC3/lib/ruby/1.8/date/format.rb:246:in `scan':
hexadecimal digit expected: v (RegexpError)
from /usr/local/jruby-1.0.0RC3/lib/ruby/1.8/date/format.rb:
222:in `__strptime'
from /usr/local/jruby-1.0.0RC3/lib/ruby/1.8/date/format.rb:
246:in `_strptime'
from /usr/local/jruby-1.0.0RC3/lib/ruby/1.8/date/format.rb:
596:in `_strptime'
from /usr/local/jruby-1.0.0RC3/lib/ruby/1.8/date.rb:1237:in
`strptime'
from :-1
A small test program that recreates the error is:
strptime_test2.rb:
#!/usr/local/jruby-1.0.0RC3/bin/jruby
# To handle the conversion from the server timestamp
require 'date'
items = ['[25/May/2007:14:20:10 -0400]']
#Define the format of the time written by the Apache server
servertime = '%d/%b/%Y:%H:%M:%S %z'
# Convert the timestamp generated by the server into a Ruby DateTime
object
timestamp = DateTime.strptime(items[0].slice(1..-2), servertime)
A corresponding test program run with ruby 1.8.4 does not produce the
error.
strptime_test.rb:
#!/usr/local/bin/ruby
# To handle the conversion from the server timestamp
require 'date'
items = ['[25/May/2007:14:20:10 -0400]']
#Define the format of the time written by the Apache server
servertime = '%d/%b/%Y:%H:%M:%S %z'
# Convert the timestamp generated by the server into a Ruby DateTime
object
timestamp = DateTime.strptime(items[0].slice(1..-2), servertime)
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email