Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use spotbugs annotations instead of javax #278

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins.aws-java-sdk</groupId>
<artifactId>aws-java-sdk-minimal</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -85,12 +79,6 @@
<artifactId>maven-plugin</artifactId>
<version>3.23</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -101,16 +89,6 @@
<artifactId>testcontainers</artifactId>
<version>1.19.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/hudson/plugins/s3/ClientHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import java.util.logging.Logger;
import java.util.regex.Pattern;

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

public class ClientHelper {
public final static String DEFAULT_AMAZON_S3_REGION_NAME = System.getProperty(
Expand Down Expand Up @@ -56,8 +56,8 @@ public static AmazonS3 createClient(String accessKey, String secretKey, boolean
* @param regionName nullable region name
* @return AWS region, never {@code null}, defaults to {@link com.amazonaws.services.s3.model.Region#US_Standard}
*/
@Nonnull
private static Region getRegionFromString(@Nullable String regionName) {
@NonNull
private static Region getRegionFromString(@CheckForNull String regionName) {
Region region = null;

if (regionName == null || regionName.isEmpty()) {
Expand All @@ -83,8 +83,8 @@ private static Region getRegionFromString(@Nullable String regionName) {
return region;
}

@Nonnull
public static ClientConfiguration getClientConfiguration(@Nonnull ProxyConfiguration proxy, @Nonnull Region region) {
@NonNull
public static ClientConfiguration getClientConfiguration(@NonNull ProxyConfiguration proxy, @NonNull Region region) {
final ClientConfiguration clientConfiguration = new ClientConfiguration();
String s3Endpoint;
if (StringUtils.isNotEmpty(ENDPOINT)) {
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/hudson/plugins/s3/S3BucketPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.interceptor.RequirePOST;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
Expand Down Expand Up @@ -151,7 +150,7 @@ protected Object readResolve() {
return this;
}

private Result constrainResult(Result r, @Nonnull TaskListener listener) {
private Result constrainResult(Result r, @NonNull TaskListener listener) {
final PrintStream console = listener.getLogger();
// pass through NOT_BUILT and ABORTED
if (r.isWorseThan(Result.FAILURE)) {
Expand Down Expand Up @@ -246,7 +245,7 @@ private void log(final Level level, final PrintStream logger, final String messa
}

@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener)
public void perform(@NonNull Run<?, ?> run, @NonNull FilePath ws, @NonNull Launcher launcher, @NonNull TaskListener listener)
throws InterruptedException, IOException {
final PrintStream console = listener.getLogger();
if (Result.ABORTED.equals(run.getResult())) {
Expand Down Expand Up @@ -368,7 +367,7 @@ private void addFingerprintAction(Run<?, ?> run, Map<String, String> record) {
}
}

private void printDiagnostics(@Nonnull FilePath ws, PrintStream console, String expanded) throws IOException {
private void printDiagnostics(@NonNull FilePath ws, PrintStream console, String expanded) throws IOException {
log(Level.WARNING, console, "No file(s) found: " + expanded);
try {
final String error = ws.validateAntFileMask(expanded, 100);
Expand All @@ -383,7 +382,7 @@ private void printDiagnostics(@Nonnull FilePath ws, PrintStream console, String
}

@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
private void fillFingerprints(@Nonnull Run<?, ?> run, @Nonnull TaskListener listener, Map<String, String> record, List<FingerprintRecord> fingerprints) throws IOException {
private void fillFingerprints(@NonNull Run<?, ?> run, @NonNull TaskListener listener, Map<String, String> record, List<FingerprintRecord> fingerprints) throws IOException {
for (FingerprintRecord r : fingerprints) {
final Fingerprint fp = r.addRecord(run);
if (fp == null) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/s3/S3CopyArtifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

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

/**
* This is a S3 variant of the CopyArtifact plugin:
Expand Down Expand Up @@ -151,7 +151,7 @@ public boolean isOptional() {
return optional != null && optional;
}

private void setResult(@Nonnull Run<?, ?> run, boolean isOk) {
private void setResult(@NonNull Run<?, ?> run, boolean isOk) {
if (isOptional()) {
return;
}
Expand All @@ -168,7 +168,7 @@ private static boolean isMavenPluginInstalled() {
}

@Override
public void perform(@Nonnull Run<?, ?> dst, @Nonnull FilePath targetDir, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException {
public void perform(@NonNull Run<?, ?> dst, @NonNull FilePath targetDir, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException {
final PrintStream console = listener.getLogger();
String expandedProject = projectName;
String includeFilter = getFilter();
Expand Down