ruby-amqp/march_hare

Calling `connect` with an IPv6 address throws a `NumberFormatException`

robbavey opened this issue · 3 comments

This happens when trying to connect using :host or :addresses

To reproduce:

jruby-9.1.14.0 :002 > MarchHare.connect(:host => '[::1]:80]')
Java::JavaLang::NumberFormatException: For input string: ":1]:80]"
	from java.lang.NumberFormatException.forInputString(java/lang/NumberFormatException.java:65)
	from java.lang.Integer.parseInt(java/lang/Integer.java:580)
	from java.lang.Integer.parseInt(java/lang/Integer.java:615)
	from com.rabbitmq.client.Address.parseAddress(com/rabbitmq/client/Address.java:74)
	from com.rabbitmq.client.Address.parseAddresses(com/rabbitmq/client/Address.java:86)
	from java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
	from org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:453)
	from org.jruby.javasupport.JavaMethod.invokeStaticDirect(org/jruby/javasupport/JavaMethod.java:365)
	from RUBY.new_connection_impl(/Users/robbavey/.rvm/gems/jruby-9.1.14.0/gems/march_hare-3.1.1-java/lib/march_hare/session.rb:539)
	from RUBY.build_new_connection(/Users/robbavey/.rvm/gems/jruby-9.1.14.0/gems/march_hare-3.1.1-java/lib/march_hare/session.rb:534)
	from RUBY.initialize(/Users/robbavey/.rvm/gems/jruby-9.1.14.0/gems/march_hare-3.1.1-java/lib/march_hare/session.rb:157)
	from org.jruby.RubyClass.newInstance(org/jruby/RubyClass.java:1008)
	from org.jruby.RubyClass$INVOKER$i$newInstance.call(org/jruby/RubyClass$INVOKER$i$newInstance.gen)
	from RUBY.connect(/Users/robbavey/.rvm/gems/jruby-9.1.14.0/gems/march_hare-3.1.1-java/lib/march_hare/session.rb:127)
	from RUBY.connect(/Users/robbavey/.rvm/gems/jruby-9.1.14.0/gems/march_hare-3.1.1-java/lib/march_hare.rb:24)
	from RUBY.<eval>((irb):2)

This is a Java client limitation. The same issue was addressed in Bunny.

rabbitmq/rabbitmq-java-client#385 was addressed, we have to wait for a new release (could take up to a couple of weeks).