Skip to content

deleteJob throws exception but works anyway... #154

Description

@cshupp1

Consider the following JRuby code:

java_import 'com.offbytwo.jenkins.JenkinsServer' do |p, c|
'JenkinsServer'
end
jenkins = JenkinsServer.new(java.net.URI.new("some_url"), "user", "password")
xml = IO.read('./config.xml')
jenkins.createJob("cris", xml, false)

The job does show up in Jenkins as expected.

If I delete the job it deletes it as expected:

jenkins.deleteJob("cris")

But it throws an exception:

irb(main):022:0> jenkins.deleteJob("cris")
org.apache.http.client.HttpResponseException: Not Found
at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11)
at com.offbytwo.jenkins.client.JenkinsHttpClient.get(JenkinsHttpClient.java:146)
at com.offbytwo.jenkins.client.JenkinsHttpClient.getQuietly(JenkinsHttpClient.java:186)
at com.offbytwo.jenkins.client.JenkinsHttpClient.post(JenkinsHttpClient.java:226)
at com.offbytwo.jenkins.client.JenkinsHttpClient.post(JenkinsHttpClient.java:397)
at com.offbytwo.jenkins.JenkinsServer.deleteJob(JenkinsServer.java:482)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:452)

So, for clarity, the job is deleted from Jenkins, but it appears to have failed. I am using 0.3.3.
Jenkins ver. 1.656

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions