Hi Rodrigo, Unfortunately your suggestion didn't work. I'm still getting a TypeError: can't convert Java::SunSecurityX509::X509CertImpl into String.
Any pointers from anybody here would be a lifesaver!! Best Regards, Carl On 6 Jan 2013, at 14:13, Carl Bourne <carl.bou...@me.com> wrote: > Thanks Rodrigo, I'll give that a try and let you know if that works. > > Carl Bourne > > On 6 Jan 2013, at 14:05, Rodrigo Rosenfeld Rosas <rr.ro...@gmail.com> wrote: > >> Hi Carl, I can't replicate your code here as it isn't a complete example (I >> don't have the response object for instance). >> >> But you could try "p" instead of "puts" or try the code below to avoid >> calling "to_s" (Ruby's equivalent of Java's toString()): >> >> puts store.get_certificates(/Safe/).object_id >> >> Best, >> Rodrigo. >> >> Em 04-01-2013 16:10, Carl Bourne escreveu: >>> >>> Hi, >>> >>> I'm fairly new to JRuby. >>> >>> Could somebody please show how I can do this using JRuby. >>> >>> How can express this java code in JRuby: - >>> >>> // Convert the store to a >>> certif >>> icate chain >>> CertStore store = response.getCertStore(); >>> Collection<? extends Certificate> certs = store >>> .getCertificates(null); >>> Certificate[] chain = new Certificate[certs.size()]; >>> >>> int i = 0; >>> for (Certificate certificate : certs) { >>> chain[i++] = certificate; >>> } >>> I have the "store" within JRuby and its recognised as a collection. >>> >>> e.g. >>> >>> puts store.type >>> #Collection >>> If I try this: >>> >>> puts store.get_certificates(/Safe/) >>> >>> I get the following type error: - >>> >>> TypeError: can't convert Java::SunSecurityX509::X509CertImpl into String >>> >>> Best Regards, >>> >>> Carl >>