Vincent Landgraf created JRUBY-6670:
---------------------------------------
Summary: XMLRPC::XMLWriter::Simple has a Problem in 1.9 Mode
Key: JRUBY-6670
URL: https://jira.codehaus.org/browse/JRUBY-6670
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.6.7
Environment: jruby-1.6.7:
system:
uname: "Darwin cool-macbook.local 11.3.0 Darwin Kernel Version
11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64
x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release
(x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.13.0 (latest) by Wayne E. Seguin
<[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "17 days 1 hour 34 minutes 1 second ago"
ruby:
interpreter: "jruby"
version: "1.6.7"
date: "2012-02-22"
platform: "darwin-x86_64-java"
patchlevel: "TM"
full_version: "jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java
HotSpot(TM) 64-Bit Server VM 1.7.0_04) [darwin-x86_64-java]"
homes:
gem: "/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7"
ruby: "/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7"
binaries:
ruby: "/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/bin/ruby"
irb: "/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/bin/irb"
gem: "/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/bin/gem"
rake: "/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7@global/bin/rake"
environment:
PATH:
"/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7/bin:/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7@global/bin:/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/bin:/Users/vincentlandgraf/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Applications/Wireshark.app/Contents/Resources/bin:/usr/local/sbin"
GEM_HOME: "/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7"
GEM_PATH:
"/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7:/Users/vincentlandgraf/.rvm/gems/jruby-1.6.7@global"
MY_RUBY_HOME: "/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7"
IRBRC: "/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/.irbrc"
RUBYOPT: ""
gemset: ""
Reporter: Vincent Landgraf
There is a bug in the handling of {{XMLRPC::XMLWriter::Simple#element(name,
attrs, *children)}}
If happens that the passed children is an {{Array<Array<String>>}} instead of
{{Array<String>}}. The {{children.join("")}} in line 49 fails because of this.
But it should be avoided, that the children contain two arrays.
The Problem ist only in 1.9 Mode and only in jruby.
I use the following monkey patch as a temporary fix:
{code:title=Patch.rb|borderStyle=solid}
class XMLRPC::XMLWriter::Simple
alias_method :unsave_element, :element
def element(name, attrs, *children)
unsave_element(name, attrs, *children.flatten)
end
end
{code}
To repoduce the problem do this:
1. Clone the project from {https://github.com/threez/rack-rpc}
2. Remove the Patch at the top of {rack-rpc/lib/rack/rpc/endpoint/xmlrpc.rb}.
It looks like in the sample above.
3. Run the tests with {bundle && rake}
The Result will look like this:
{code}
/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/bin/jruby -S rspec
./spec/endpoint_spec.rb ./spec/jsonrpc_spec.rb ./spec/server_spec.rb
./spec/version_spec.rb ./spec/xmlrpc_spec.rb
.....FF...............................F
Failures:
1) Rack::RPC::Endpoint handles XML requests (application/xml)
Failure/Error: post "/rpc", {},
Factory.valid_xml_request('CONTENT_TYPE'=> 'application/xml')
TypeError:
can't convert Array into String
# ./lib/rack/rpc/endpoint/xmlrpc.rb:54:in `process'
# ./lib/rack/rpc/endpoint/xmlrpc.rb:43:in `execute'
# ./lib/rack/rpc/endpoint.rb:40:in `call'
# ./spec/endpoint_spec.rb:34:in `(root)'
2) Rack::RPC::Endpoint handles XML requests (text/xml)
Failure/Error: post "/rpc", {},
Factory.valid_xml_request('CONTENT_TYPE'=> 'text/xml')
TypeError:
can't convert Array into String
# ./lib/rack/rpc/endpoint/xmlrpc.rb:54:in `process'
# ./lib/rack/rpc/endpoint/xmlrpc.rb:43:in `execute'
# ./lib/rack/rpc/endpoint.rb:40:in `call'
# ./spec/endpoint_spec.rb:39:in `(root)'
3) Rack::RPC::Endpoint::XMLRPC returns valid response when request is valid
Failure/Error: post "/rpc", {}, Factory.valid_xml_request
TypeError:
can't convert Array into String
# ./lib/rack/rpc/endpoint/xmlrpc.rb:54:in `process'
# ./lib/rack/rpc/endpoint/xmlrpc.rb:43:in `execute'
# ./lib/rack/rpc/endpoint.rb:40:in `call'
# ./spec/xmlrpc_spec.rb:42:in `(root)'
Finished in 2.62 seconds
39 examples, 3 failures
Failed examples:
rspec ./spec/endpoint_spec.rb:33 # Rack::RPC::Endpoint handles XML requests
(application/xml)
rspec ./spec/endpoint_spec.rb:38 # Rack::RPC::Endpoint handles XML requests
(text/xml)
rspec ./spec/xmlrpc_spec.rb:41 # Rack::RPC::Endpoint::XMLRPC returns valid
response when request is valid
org.jruby.exceptions.RaiseException: (SystemExit) exit
rake aborted!
/Users/vincentlandgraf/.rvm/rubies/jruby-1.6.7/bin/jruby -S rspec
./spec/endpoint_spec.rb ./spec/jsonrpc_spec.rb ./spec/server_spec.rb
./spec/version_spec.rb ./spec/xmlrpc_spec.rb failed
Tasks: TOP => default => spec
(See full trace by running task with --trace)
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email