Closed bliaxiong closed 8 years ago
I can confirm, I have this issue as well. Projects.all seems to work ok for me.
I can reproduce with ruby 1.9.1 and 2.0. I'm on Jira 6.2
This is interesting. I don't know offhand that we'll be able to fix this for jruby 1.7, but I'm definitely looking into it for >=1.9.x. If anyone else sorts it first I'll merge it in right away.
Here is my trace:
/usr/lib/ruby/1.9.1/net/http.rb:1591:in `capitalize': undefined method `split' for :expand:Symbol (NoMethodError)
from /usr/lib/ruby/1.9.1/net/http.rb:1584:in `block in each_capitalized'
from /usr/lib/ruby/1.9.1/net/http.rb:1583:in `each'
from /usr/lib/ruby/1.9.1/net/http.rb:1583:in `each_capitalized'
from /usr/lib/ruby/1.9.1/net/http.rb:2074:in `write_header'
from /usr/lib/ruby/1.9.1/net/http.rb:1926:in `exec'
from /usr/lib/ruby/1.9.1/net/http.rb:1318:in `block in transport_request'
from /usr/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
from /usr/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
from /usr/lib/ruby/1.9.1/net/http.rb:1294:in `request'
from /usr/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
from /usr/lib/ruby/1.9.1/net/http.rb:746:in `start'
from /usr/lib/ruby/1.9.1/net/http.rb:1285:in `request'
from /var/lib/gems/1.9.1/gems/jira-ruby-0.1.9/lib/jira/http_client.rb:22:in `make_request'
from /var/lib/gems/1.9.1/gems/jira-ruby-0.1.9/lib/jira/request_client.rb:13:in `request'
from /var/lib/gems/1.9.1/gems/jira-ruby-0.1.9/lib/jira/client.rb:155:in `request'
from /var/lib/gems/1.9.1/gems/jira-ruby-0.1.9/lib/jira/client.rb:134:in `get'
from /var/lib/gems/1.9.1/gems/jira-ruby-0.1.9/lib/jira/resource/issue.rb:37:in `all'
from /var/lib/gems/1.9.1/gems/jira-ruby-0.1.9/lib/jira/base_factory.rb:33:in `block (2 levels) in delegate_to_target_class'
from test.rb:25:in `<main>'
Let me know if there is more data I can provide. The basic http stuff does work, as I can list projects, so I guess it is "issue" specific?
I've tried doing .all and doing a sql query style per the examples, both give the same trace.
Digging into this, the issue is somewhere in: https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/resource/issue.rb#L39
But I don't yet understand how :expand and transitions.fields work.
Hi, the same issue for me with Ruby 2, Rails 4.
@jira_client.Issue.all
NoMethodError: undefined method split' for :expand:Symbol from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/header.rb:172:in
capitalize'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/header.rb:165:in block in each_capitalized' from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/header.rb:164:in
each'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/header.rb:164:in each_capitalized' from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/generic_request.rb:321:in
write_header'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http/generic_request.rb:136:in exec' from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:1406:in
block in transport_request'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:1405:in catch' from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:1405:in
transport_request'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:1378:in request' from /var/www/getfable.com/releases/57/vendor/bundle/ruby/2.1.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in
request'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:1371:in block in request' from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:853:in
start'
from /home/sessionly/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/http.rb:1369:in request' from /var/www/getfable.com/releases/57/vendor/bundle/ruby/2.1.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in
request'
from /var/www/getfable.com/releases/57/vendor/bundle/ruby/2.1.0/gems/oauth-0.4.7/lib/oauth/consumer.rb:161:in `request'
... 10 levels...
Any suggestion for fix? Thanks!
Updating :expand Symbol to a String work for me! Like: https://github.com/fertobar/jira-ruby/commit/36369feb1d12f7bcd30d1d157262df68159b6947
Now, I'm getting the Issue list ok!
From what I read of the code, this commit introduced the bug by trying to pass an invalid HTTP header (:expand
) to the Client#get
method. I'm totally new to this project (and to JIRA), but I'm going to figure out the original author's intention of trying to pass this :expand
option.
sounds good Andrew. I notice http dependency try to apply to the options, the call to split method, but Symbols not respond to split method, so, updating the symbol :expand to a string works for me, because String respond to split method. Also specs works too. I have no permission for commit in the repository :)
I solved the issue and am working on putting together a pull request. The problem was that the url should have been /search?expand=transitions.fields
. The other problem was that there didn't seem to be a test for the Issue.all
method. I'm working on writing a test for that too.
I have found that I can do an empty JQL search in the issues to retrieve all the issues if the original way doesn't work.
client.Issue.jql('')
I'm getting an error when running 'client.Issue.all' when running code in the console. Any help is greatly appreciative.
JRuby 1.7.10 Mac
Trace:
jruby-1.7.10 :029 > client.Issue.all NoMethodError: undefined method
split' for :expand:Symbol from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1598:in
capitalize' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1591:ineach_capitalized' from org/jruby/RubyHash.java:1338:in
each' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1590:ineach_capitalized' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:2081:in
write_header' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1933:inexec' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1325:in
transport_request' from org/jruby/RubyKernel.java:1282:incatch' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1324:in
transport_request' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1301:inrequest' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in
request' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1294:inrequest' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:745:in
start' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1292:inrequest' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in
request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/http_client.rb:22:inmake_request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/request_client.rb:13:in
request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/client.rb:151:inrequest' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/client.rb:130:in
get' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/resource/issue.rb:37:inall' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/base_factory.rb:33:in
all' from (irb):29:inevaluate' from org/jruby/RubyKernel.java:1119:in
eval' from org/jruby/RubyKernel.java:1519:inloop' from org/jruby/RubyKernel.java:1282:in
catch' from org/jruby/RubyKernel.java:1282:incatch' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/railties-3.2.17/lib/rails/commands/console.rb:47:in
start' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/railties-3.2.17/lib/rails/commands/console.rb:8:instart' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/railties-3.2.17/lib/rails/commands.rb:41:in
(root)' from org/jruby/RubyKernel.java:1083:inrequire' from script/rails:6:in
(root)'jruby-1.7.10 :030 >