groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Schott <>
Subject Method parameters changed when calling HTTPClient.addRequestInterceptor()
Date Sun, 10 Jan 2016 22:53:50 GMT
Hi all,

I'm relatively new to Groovy (I mostly use it for scripting Jenkins and
JIRA) and I have a problem with a script I'm trying to run on Jenkins. I
think it may be language related (so not a bug per se) so I thought I would
post it here.

I'm using the HTTPBuilder library to make REST calls to JIRA from Jenkins.
I am also using the Jenkins Groovy Postbuild plugin to trigger the script
which handles this. The script works fine (connects to JIRA and creates or
modifies an issue) but I decided I wanted to call it from another script (
a loader, so to speak ), so I wrapped the script into a class. This fails
with a "No signature of method" error. The problem appears to be the
request interceptor that handles authentication. The loader calls two
different scripts, both of them which use HTTPBuilder to connect to HTTP
services but only the script with the request interceptor fails. The bit of
offending code is this: is the class that contains the code,
although it is not part of the script (it is loaded from the JAR that
contains all the classes). Somehow, the HTTPClient object is being passed a
reference is being passed a reference to its containing instance, rather
than the interceptor object I am literally passing in code.

The funny thing is that when the class that contains the script is removed
(i.e. the class declaration is stripped), and the script is placed directly
into the postbuild plugin script entry, the script works fine. We have been
using it for several months and have only encountered this issue when it
has been placed in it's own class.

I'm guessing there might be some dynamic fanciness happening that I don't
understand, but I don't really know where to start investigating. I've
tried setting the username and password in the standard way but that
doesn't work because JIRA is set to not challenge for authentication. I've
also tried constructing the interceptor separately and passing the
reference but it was the same.

I'm hoping someone with more knowledge of Groovy might be able to point me
in the right direction.


Sven Schott

View raw message