Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 0.9.0
-
Fix Version/s: JRuby 0.9.1
-
Component/s: Interpreter
-
Labels:None
-
Environment:JRuby 0.9.0 with Rails 1.1.4
Description
C:\jruby-0.9.0\cookbook>c:\jruby-0.9.0\bin\jruby script/generate ajax_scaffold recipe
C:/jruby-0.9.0/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/oracle_adapter.rb:118 warning: (...) interpreted as grouped expression
exists test/unit/
exists test/fixtures/
exists app/controllers/
exists app/helpers/
create app/views/recipes
exists app/views/layouts/
exists public/images
exists test/functional/
create app/models/recipe.rb
create test/unit/recipe_test.rb
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
I looked at this a bit and it appears to be a problem related to regular expressions and line terminations. There are a pair of regular expressions in erb.rb that look for start and end tags in a template file, but these seem to make some unfortunate assumptions about line terminators:
stag_reg = /(.*?)(<%%|<%=|<%#|<%-|<%|\n|\z)/
etag_reg = /(.*?)(%%>|-%>|%>|\n|\z)/
The template file 'unit_test.rb' from the ajax_scaffold distribution is opened in binary mode and has Windows '\r\n' line terminators. The '.' in the regular expressions doesn't appear to match the '\r', which eventually leads to the attempted subscripting of nil. Altering these regular expressions to look for '\r\n' in their second groups gets past the problem:
stag_reg = /(.*?)(<%%|<%=|<%#|<%-|<%|\n|\r\n|\z)/
etag_reg = /(.*?)(%%>|-%>|%>|\n|\r\n|\z)/
Probably not an ideal solution...
Also, there's still a problem even after making these changes:
uninitialized constant SO_KEEPALIVE