Hi

I just fired up a branch new rails 3-1-stable project using jruby 1.6.2 in
1.9 mode. Sprockets is pushing out a "TypeError (can't convert Pathname into
String)" when it internally calls digest.file with a Pathname. I cobbled
together a quick test under the sprockets test folder like so:

test "pathname can be used by digest" do
  Digest::MD5.file(Pathname.new "/tmp/testfile")
end

And it spits out the following stacktrace:

test "pathname can be used by digest":
TypeError: can't convert Pathname into String
    /src/github/sprockets/test/test_environment.rb:615:in `test "pathname
can be used by digest"'
    org/jruby/RubyBasicObject.java:1667:in `__send__'

And that's all you get. Line 1667 is in send19 function of RubyBasicObject:

1663: @JRubyMethod(name = "__send__", compat = RUBY1_9)
1664: public IRubyObject send19(ThreadContext context, IRubyObject arg0,
Block block) {
1665:     String name = arg0.asJavaString();
1666:
1667:     return getMetaClass().finvoke(context, this, name, block);
1668: }

There's no sign of RubyDigest.java, so I'm guessing there's no more info in
the stack trace because at this point it's gone into the native md5
implementation? I'm a noob at this jruby lark so I'm not sure what to do
next to get this working. Do I need to put some sort of wrapper into jruby
with something like this in:

def file(path)
  native.file(path.to_s)
end

?

Cheers
Lee

Reply via email to