matadon / mizuno

Jetty-powered running shoes for JRuby/Rack.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prefer to_s versus toString

azell opened this issue · comments

With JRuby 1.7dev (which by default runs in Ruby 1.9 mode) and JRE 1.7.0_03, request.getRequestURL can come in as either a Java StringBuffer or a Ruby string. Calling toString on a Ruby string raises an exception. Changing the assignment to:

    env['REQUEST_URI'] = request.getRequestURL.to_s

appears to be safe, regardless of whether getRequestURL is a Java object or Ruby object. I am not sure if it is considered a bug in JRuby 1.7dev for the getRequestURL type to mutate between requests.

JRuby bug report is at: http://jira.codehaus.org/browse/JRUBY-6619

Done in 0.6.3; thanks for the heads up!