artifactory-client icon indicating copy to clipboard operation
artifactory-client copied to clipboard

TypeError thrown on build.save (artifactory server 5.2.1)

Open tnaroska opened this issue 9 years ago • 0 comments

After upgrading artifactory server to 5.2.1, build creation using Resource::Build.save results in a TypeError

/opt/chefdk/embedded/lib/ruby/2.1.0/json/common.rb:155:in `initialize': no implicit conversion of nil into String (TypeError)
	from /opt/chefdk/embedded/lib/ruby/2.1.0/json/common.rb:155:in `new'
	from /opt/chefdk/embedded/lib/ruby/2.1.0/json/common.rb:155:in `parse'
	from /media/drive1/jenkins/.chefdk/gem/ruby/2.1.0/gems/artifactory-2.8.1/lib/artifactory/client.rb:372:in `success'
	from /media/drive1/jenkins/.chefdk/gem/ruby/2.1.0/gems/artifactory-2.8.1/lib/artifactory/client.rb:272:in `block in request'
	from /opt/chefdk/embedded/lib/ruby/2.1.0/net/http.rb:853:in `start'
	from /media/drive1/jenkins/.chefdk/gem/ruby/2.1.0/gems/artifactory-2.8.1/lib/artifactory/client.rb:256:in `request'
	from /media/drive1/jenkins/.chefdk/gem/ruby/2.1.0/gems/artifactory-2.8.1/lib/artifactory/client.rb:136:in `put'
	from /media/drive1/jenkins/.chefdk/gem/ruby/2.1.0/gems/artifactory-2.8.1/lib/artifactory/resources/build.rb:208:in `save'

The server operation succeeded, but returns an HTTP 204 (no content) now and an empty response. Code in Client.success() needs to check for this HTTP code instead of blindly passing nil content to the json parser.

tnaroska avatar Apr 24 '17 20:04 tnaroska