Re: [jruby-dev] JRuby equivalent to Java Code

2013-01-07 Thread Carl Bourne
Kristian, Thanks so much for this. I'm sure exactly is happening here but by passing in a nil to the .get_certificates method it all works as expected. It now returns 2 certificate objects as it should. Best Regards, Carl On 7 Jan 2013, at 03:53, kristian wrote: > you example says store is

Re: [jruby-dev] JRuby equivalent to Java Code

2013-01-07 Thread kristian
I am uncertain what is going on,, too. but the suggestion of Rodrigo did not work, so the hope was without the matcher /Safe/ that the underlying code does not expect some "String" happy that the little workaround worked :) - Kristian On Mon, Jan 7, 2013 at 3:22 PM, Carl Bourne wrote: > Kristia

Re: [jruby-dev] JRuby equivalent to Java Code

2013-01-07 Thread Rodrigo Rosenfeld Rosas
Hi Carl, I was just looking at the CertStore API: http://docs.oracle.com/javase/1.4.2/docs/api/java/security/cert/CertStore.html#getCertificates(java.security.cert.CertSelector)

Re: [jruby-dev] JRuby equivalent to Java Code

2013-01-07 Thread Carl Bourne
Kristian, > getCertificates() expects a CertSelector object, not a regular expression I think this was the bit I overlooked and was obviously confused by! I also realise now that nil is equivalent to Java's null. I'll certainly make sure I include more relevant information in any future posts

Re: [jruby-dev] JRuby equivalent to Java Code

2013-01-07 Thread Rodrigo Rosenfeld Rosas
Em 07-01-2013 08:48, Carl Bourne escreveu: Kristian, getCertificates() expects a CertSelector object, not a regular expression I think this was the bit I overlooked and was obviously confused by! I also realise now that nil is equivalent to Java's null. I'll certainly make sure I include m

[jruby-dev] JRuby String to CharArray

2013-01-07 Thread Carl Bourne
Hi, I may be misunderstanding something here, but Is there an easy way in JRuby/Ruby to convert a string such as "lexicon" into a character array? The only way I've been able to achieve this so far is like this: - > String.new("lexicon").toCharArray) Which requires me to: - > java_import

Re: [jruby-dev] JRuby String to CharArray

2013-01-07 Thread Benjamin Browning
You can accomplish the same thing without String.new via "lexicon".to_java.toCharArray And, I wouldn't suggest using java_import for java.lang.String since as you've noticed (via the already initialized constant warning) that conflicts with Ruby's built-in String class. Ben On Jan 7, 2013, at

Re: [jruby-dev] JRuby String to CharArray

2013-01-07 Thread Carl Bourne
Thanks Ben, That did the trick perfectly! On another note, is there an easier way to load the example.jks keystore file without needing to use Java's FileInputStream? Regards, Carl Bourne On 7 Jan 2013, at 22:10, Benjamin Browning wrote: > You can accomplish the same thing without String

Re: [jruby-dev] JRuby String to CharArray

2013-01-07 Thread Benjamin Browning
There is a way to get an InputStream from a file in JRuby without using FileInputStream: File.new("example.jks").to_inputstream So your example becomes: kstore.load(File.new("example.jks").to_inputstream, "lexicon".to_java.toCharArray) Ben On Jan 7, 2013, at 5:32 PM, Carl Bourne wrote: > T

Re: [jruby-dev] JRuby String to CharArray

2013-01-07 Thread Carl Bourne
Thanks Ben - that's really useful to know! I'll give that a try tomorrow. Sent from my iPad On 7 Jan 2013, at 22:54, Benjamin Browning wrote: > There is a way to get an InputStream from a file in JRuby without using > FileInputStream: > > File.new("example.jks").to_inputstream > > So your

Re: [jruby-dev] JRuby String to CharArray

2013-01-07 Thread Rodrigo Rosenfeld Rosas
I'm on my phone now but if I remember correctly you should give 'a string'.chars (or mb_chars) a try using plain Ruby API. Em 07/01/2013 20:03, "Carl Bourne" escreveu: > Hi, > > I may be misunderstanding something here, but Is there an easy way in > JRuby/Ruby to convert a string such as "lexicon