Enabled jruby and rbx for Travis CI.

Also fixed one bug and one warning encountered while
running the unit tests against jruby.