Skip to content

Commit

Permalink
Fix JENKINS-10731
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Aug 25, 2011
1 parent 75736ed commit cd64307
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
14 changes: 2 additions & 12 deletions src/main/java/org/jenkinsci/plugins/urltrigger/URLTrigger.java
Expand Up @@ -89,16 +89,12 @@ private boolean checkForScheduling(URLTriggerLog log) throws URLTriggerException
ClientConfig cc = new DefaultClientConfig();
Client client = Client.create(cc);
for (URLTriggerEntry entry : entries) {
//Get the url
String url = entry.getUrl();

//Invoke the Url and process its response
log.info(String.format("Invoking the url: \n %s", url));
ClientResponse clientResponse = client.resource(url).get(ClientResponse.class);
//Get the business service

URLTriggerService urlTriggerService = URLTriggerService.getInstance();
if (urlTriggerService.isSchedulingForURLEntry(clientResponse, entry, log)) {
urlTriggerService.refreshContent(clientResponse, entry);
return true;
}
}
Expand Down Expand Up @@ -158,15 +154,9 @@ public void start(BuildableItem project, boolean newInstance) {
ClientConfig cc = new DefaultClientConfig();
Client client = Client.create(cc);
for (URLTriggerEntry entry : entries) {

//Get the url
String url = entry.getUrl();

//Invoke the Url and process its response
ClientResponse clientResponse = client.resource(url).get(ClientResponse.class);

//Process the entry
service.processURLEntryFromStartStage(clientResponse, entry);
service.initContent(clientResponse, entry);
}
} catch (URLTriggerException urle) {
LOGGER.log(Level.SEVERE, "Error on trigger startup " + urle.getMessage());
Expand Down
Expand Up @@ -22,7 +22,11 @@ public static URLTriggerService getInstance() {
return INSTANCE;
}

public void processURLEntryFromStartStage(ClientResponse clientResponse, URLTriggerEntry entry) throws URLTriggerException {
public void refreshContent(ClientResponse clientResponse, URLTriggerEntry entry) throws URLTriggerException {
initContent(clientResponse, entry);
}

public void initContent(ClientResponse clientResponse, URLTriggerEntry entry) throws URLTriggerException {

if (clientResponse == null) {
throw new NullPointerException("The given clientResponse object is not set.");
Expand Down

0 comments on commit cd64307

Please sign in to comment.