stompgem / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.
http://stomp.github.com
Apache License 2.0
152 stars 80 forks source link

SSL Example Use Case 4 Fails with JRuby 1.6.5 #36

Closed mindscratch closed 12 years ago

mindscratch commented 12 years ago

I'm using Stomp 1.2.2 with JRuby 1.6.5 (using Ruby 1.9 compatibility) and the SSL example use case 4 doesn't work.

In connection.rb, line 688 which reads the "cert_file", it uses File.open. Also line 691 (which reads the key_file) uses File.open. This works with Ruby but not with JRuby (at least 1.6.5).

In JRuby "File.read" needs to be used, such as:

ctx.cert = OpenSSL::X509::Certificate.new(File.read(@ssl.cert_file))
ctx.key  = OpenSSL::PKey::RSA.new(File.read(@ssl.key_file))

If File.open is used JRuby throws an error "can't convert File into String" from their X509Cert class.

Ultimately JRuby probably needs to be fixed so that it can handle a File object (the result of File.open) as well as a String (File.read).

However, since File.read works in Ruby and JRuby I thought perhaps Stomp could be updated to use it so SSL will work with JRuby today.

gmallard commented 12 years ago

Thanks, we'll get this into the mix for the next gem version. Will likely run the merge locally, and not from github.

I suggest you open an issue in JRuby JIRA if one is not open already.

mindscratch commented 12 years ago

Thanks. I did open an issue in JRuby (on github).

gmallard commented 12 years ago

OK. I have no idea what tracker they actually use. I have one open issue for another problem with them at:

https://jira.codehaus.org/browse/JRUBY

gmallard commented 12 years ago

Merged in to 'dev' branch, scheduled for 1.2.3. Ref:

b84e282887ba92a80ab9b08b1aa1132dba453be9