Skip to content

Conversation

@mezpahlan
Copy link

The current POM structure is quite out of date to what you get when creating an up to date Hello World plugin from the tutorial web pages. This PR updates the structure and versions of the parent POM.

Along with being aligned to the new structure we also resolve Enforcer and Findbug errors that come as a result of the newer Jenkins plugin dependencies.

The overall aim was to add support for a friendly syntax whilst using this plugin in pipeline mode. Getting the POM up to date seems a good first step to that.

Corrects Enforcer rule RequireUpperBoundDeps.
Resolves Findbugs URF_UNREAD_FIELD
Resolves Findbugs NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
Resolves Findbugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
Resolves Findbugs DM_DEFAULT_ENCODING
Resolves Findbugs REC_CATCH_EXCEPTION
Resolves Findbugs NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
Resolves Findbugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE
Resolves Findbugs OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE
Accidentally removed too many fields in previous commits and forgot to
remove data bound constructor params in another previous commit.
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.

Note that there is already #45, which facelifts the plugin without breaking changes and reformatting. It does not fix FindBugs tho


@DataBoundConstructor
public HockeyappApplication(String apiToken, String appId, boolean notifyTeam,
public HockeyappApplication(String apiToken, boolean notifyTeam,
Copy link
Member

Choose a reason for hiding this comment

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

breaks binary compatibility

@mezpahlan
Copy link
Author

I see now. Yes, you're quite right. Apologies. (First time contributing to Jenkins, forgive me).

  1. What would you suggest with regards to this PR? Undo the charges that break binary compatibility, undo changes that duplicate [JENKINS-48949] - Make the plugin testable in PCT with JEP-200 #45, leave the Findbugs fixes? Something else?
  2. With regards to that breaks binary compatibility comment: Findbugs complains that the field the parameter sets is unused. So removing the field to make Findbugs happy surely means removing the parameter?

Anyways, thanks for looking at this.

@oleg-nenashev
Copy link
Member

@mezpahlan no problem at all, it happens. Generally we need a plugin maintainer to review and integrate something. I would not mind if your PR gets integrated instead of mine. In #45 I have also replaced bundled libs by Apache HttpComponents Client 4.x API Plugin, but it can be done in a follow-up if needed.

I am not sure who is the current plugin maintainer, @Brantone @dkochetkov and @ohoeltke are listed in https://github.com/jenkins-infra/repository-permissions-updater/blob/master/permissions/plugin-hockeyapp.yml

With regards to that breaks binary compatibility comment: Findbugs complains that the field the parameter sets is unused. So removing the field to make Findbugs happy surely means removing the parameter?

The field is public, so it may be used somehow. My recommendation would be to just use @SupressFBWarnings with a "TODO" comment for now

Add a suppression to Findbugs with a follow up TODO comment.
@mezpahlan
Copy link
Author

Thanks I've reverted that binary breaking change and added your suggestions. Hopefully one of the maintainers can also chime in and move this forward. I'd love to help out with further improvements to this plugin in the future too. Happy to help where I can.

pom.xml Outdated
<properties>
<jenkins.version>1.609.2</jenkins.version>
<java.level>7</java.level>
<jenkins-test-harness.version>2.38</jenkins-test-harness.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 suggest to remove it and let O=PluginPOM use it's default one

pom.xml Outdated
<packaging>hpi</packaging>

<properties>
<jenkins.version>1.609.2</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.

If you require Java 7, it's better to update to Jenkins 1.625.3. Just because 1.609.x can run on Java 6 and hence the plugin may not work there

@SuppressFBWarnings(value = {"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"}, justification = "Breaks binary compatibility if removed.")
@XStreamAsAttribute
public long schemaVersion;
public long schemaVersion; // TODO: Fix Findbugs gracefully.
Copy link
Member

Choose a reason for hiding this comment

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

Should it be marked as deprecated then? Just in case thee is really no usages anywhere (including Jelly and Co)

return FormValidation.errorWithMarkup(
"You must enter an <a href=\"https://rink.hockeyapp.net/manage/auth_tokens\">API Token</a>.");
if (value.isEmpty()) {
final Jenkins instance = Jenkins.getInstance();
Copy link
Member

Choose a reason for hiding this comment

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

in 1.625.3 you can use getActiveInstance() IIRC. Jenkins instance cannot be really null here


private static final Charset UTF8_CHARSET = Charset.forName("UTF-8");
private static final String UTF8 = "UTF-8";
private static final Charset UTF8_CHARSET = Charset.forName(UTF8);
Copy link
Member

Choose a reason for hiding this comment

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

In Java 7 you can use StandardCharsets.

pom.xml Outdated
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
Copy link
Member

Choose a reason for hiding this comment

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

Once the core is updated to 1.625.3, you could use Apache HttpComponents Client 4.x API plugin instead

pom.xml Outdated
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you just use the version from the core?

mezpahlan added 8 commits May 1, 2018 20:23
Uses the jenkins-test-harness version defined in the parent POM.
We require Java 7 so 1.625.3 is a better fit for that.
We can let someone else manage Apache HttpComponents for us :)
This is inherited from the parent anyway. It also looks wrong.
Appears to be unused in this project.
pom.xml Outdated
</developers>


<url>http://wiki.jenkins-ci.org/display/JENKINS/HockeyApp+Plugin</url>
Copy link
Member

Choose a reason for hiding this comment

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

@mezpahlan mezpahlan self-assigned this May 28, 2018
@mezpahlan mezpahlan merged commit 3c056df into jenkinsci:master May 28, 2018
@mezpahlan mezpahlan deleted the update-pom-structure branch May 28, 2018 17:45
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.

2 participants