Skip to content

Conversation

@stephenc
Copy link
Member

@stephenc stephenc commented Nov 8, 2016

See JENKINS-39590

Work In Progress until hub4j/github-api#306 is merged and https://github.com/jenkinsci/github-api-plugin/ gets a release (also needs to be on top of #153)


This change is Reviewable

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to wait till the merge of the upstream PR before reviewing

pom.xml Outdated
<properties>
<jenkins.version>1.580</jenkins.version>
<jenkins-test-harness.version>1.580</jenkins-test-harness.version>
<jenkins.version>1.615</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vouch for using LTS baseline like 1.625 since you go beyond the Java 6 compat threshold anyway

parseAssociatedNames((AbstractProject<?, ?>) item, result);
}
} else {
throw new AbstractMethodError("you must override the new overload of parseAssociatedNames");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see another PR

@stephenc
Copy link
Member Author

stephenc commented Nov 9, 2016

@oleg-nenashev I created this PR (and tagged as WIP) so that the upstream PRs can be reviewed with an intended usage example... i.e. This PR

@stephenc stephenc changed the title [WIP] [JENKINS-39590] Switch to GitHub.parseEventPayload for event parsing [JENKINS-39590] Switch to GitHub.parseEventPayload for event parsing Dec 16, 2016
@stephenc
Copy link
Member Author

stephenc commented Jan 4, 2017

@reviewbybees

@stephenc
Copy link
Member Author

stephenc commented Jan 9, 2017

@reviewbybees ping

* @param payload payload of gh-event. Never blank
*/
@Override
protected void onEvent(GHEvent event, String payload) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does onEvent report errors itself? Then catch not needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try {
subscriber.onEvent(event, payload);
} catch (Throwable t) {
LOGGER.error("Subscriber {} failed to process {} hook, skipping...",
subscriber.getClass().getName(), event, t);
}
return null;

so try-catch useless wrapper, undo change and check that parser reports meaningful error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That Throwable catch should be the last ditch catch. Propagation to it is not a good pattern.

I'll see if I can decipher what you mean tomorrow on computer not phone. But in general you should catch and log as close and as specific as possible while you know what sense to make...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In just you can trust to any underlying extension as it may throw NPE, so catching throwables and reporting is standard save ass pattern. If exception throws meaningful information then additional exception steps doesn't add anything useful for debugging.

Copy link
Member

@KostyaSha KostyaSha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try-catch useless

@lanwen
Copy link
Member

lanwen commented Jan 11, 2017

LGTM

@ghost
Copy link

ghost commented Jan 11, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

String fullDisplayName = job.getFullDisplayName();
LOGGER.debug("Considering to poke {}", fullDisplayName);
if (GitHubRepositoryNameContributor.parseAssociatedNames(job)
.contains(changedRepository)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid gratuitous reformatting of otherwise unmodified lines.

@stephenc
Copy link
Member Author

@reviewbybees done

@lanwen lanwen merged commit 150fc93 into jenkinsci:master Jan 12, 2017
@lanwen
Copy link
Member

lanwen commented Jan 12, 2017

released as 1.25.1

@stephenc stephenc deleted the jenkins-39590 branch January 12, 2017 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants