Skip to content

Commit

Permalink
Merge pull request #50 from aneveux/plugin-modernization
Browse files Browse the repository at this point in the history
Applying plugin modernization guidance
  • Loading branch information
jglick authored Aug 24, 2023
2 parents e0513aa + c37f3fb commit 2f41742
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 27 deletions.
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/view-job-filters-plugin</gitHubRepo>
<jenkins.version>2.387.1</jenkins.version>
<jenkins.version>2.387.3</jenkins.version>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.387.x</artifactId>
<version>1887.vda_d0ddb_c15c4</version>
<version>2329.v078520e55c19</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/views/BuildFilterColumn.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package hudson.views;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.DescriptorExtensionList;
import hudson.Extension;
Expand All @@ -17,9 +19,6 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

/**
* This column wraps another column so that when that delegate column renders, it is
* given a JobWrapper that provides a filtered list of Runs to the column.
Expand Down Expand Up @@ -111,6 +110,7 @@ public ListViewColumn getDelegate() {
}

@SuppressWarnings("unchecked")
@SuppressFBWarnings(value="REC_CATCH_EXCEPTION")
public Job getJobWrapper(final Job job) {

final JobWrapper wrapper = new JobWrapper(job);
Expand Down Expand Up @@ -249,7 +249,7 @@ public RunWrapper(Run delegate) {
this.delegate = delegate;
}

@Nonnull
@NonNull
@Override
protected Run _this() {
return this;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/hudson/views/EmailValuesHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import java.util.ArrayList;
import java.util.List;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class EmailValuesHelper {

private static List<AbstractEmailValuesProvider> matchers = buildMatchers();

@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public static List<String> getValues(TopLevelItem item) {
List<String> values = new ArrayList<String>();
if (item == null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/views/JenkinsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import jenkins.model.Jenkins;

import javax.annotation.Nonnull;
import edu.umd.cs.findbugs.annotations.NonNull;

public class JenkinsUtil {
@Nonnull
@NonNull
public static Jenkins getInstance() {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins != null) {
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/hudson/views/UnclassifiedJobsFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ protected void doFilter(List<TopLevelItem> filtered, List<TopLevelItem> all, Vie
}
}

private boolean containsUnclassifiedJobsFilter(View view) {
if (view instanceof ListView) {
ListView listView = (ListView)view;
for (ViewJobFilter filter: listView.getJobFilters()) {
if (filter instanceof UnclassifiedJobsFilter) {
return true;
}
}
}
return false;
}

private List<TopLevelItem> getAllClassifiedItems(Set<View> allViews, int allJobsCount, View filteringView) {
List<TopLevelItem> classified = new ArrayList<TopLevelItem>();
for (View otherView: allViews) {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/hudson/views/UserRelevanceFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@

import java.lang.reflect.Method;
import java.util.List;
import java.util.Locale;

import org.kohsuke.stapler.DataBoundConstructor;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Filters jobs that are relevant to the user.
* @author Jacob.Robertson
*/
public class UserRelevanceFilter extends AbstractBuildTrendFilter {

private static final String ANONYMOUS = Hudson.ANONYMOUS.getName().toUpperCase();
private static final String ANONYMOUS = Hudson.ANONYMOUS.getName().toUpperCase(Locale.ROOT);


private boolean matchUserId = true;
private boolean matchUserFullName = true;
Expand Down Expand Up @@ -119,7 +122,8 @@ public boolean runMatches(String userName, boolean matchAgainstFullName, Run run
}
public String normalize(String userName) {
if (ignoreCase) {
userName = userName.toUpperCase();
userName = userName.toUpperCase(Locale.ROOT);

}
if (!ignoreNonAlphaNumeric && !ignoreWhitespace) {
return userName;
Expand Down Expand Up @@ -211,6 +215,7 @@ public String getUserValue(Cause cause, boolean matchAgainstFullName) {
}
return builderName;
}
@SuppressFBWarnings("REC_CATCH_EXCEPTION")
public String getUserValue(Cause cause, String methodName) {
Method m = ReflectionUtils.getPublicMethodNamed(cause.getClass(), methodName);
if (m == null) {
Expand Down
5 changes: 0 additions & 5 deletions src/test/java/hudson/views/AbstractJenkinsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
import java.io.IOException;
import java.util.List;

import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.JenkinsRule;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import javax.annotation.CheckForNull;
import javax.servlet.ReadListener;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
Expand Down

0 comments on commit 2f41742

Please sign in to comment.