Skip to content

Commit

Permalink
Remove unnecessary suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Mar 5, 2025
1 parent d4ff4f9 commit e286c45
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
3 changes: 0 additions & 3 deletions src/main/java/hudson/plugins/git/Revision.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static java.util.stream.Collectors.joining;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Util;
import java.io.Serial;
import java.util.ArrayList;
Expand Down Expand Up @@ -54,7 +53,6 @@ public Revision(ObjectId sha1, Collection<Branch> branches) {
*
* @return a {@link org.eclipse.jgit.lib.ObjectId} object.
*/
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "Published API in GitObject and Revision")
public ObjectId getSha1() {
/* Returns an immutable ObjectId to avoid caller modifying ObjectId using returned ObjectId */
return (sha1 == null) ? null : sha1.toObjectId();
Expand All @@ -65,7 +63,6 @@ public ObjectId getSha1() {
*
* @return a {@link java.lang.String} object.
*/
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "Published API in GitObject and Revision")
@Exported(name = "SHA1")
public String getSha1String() {
return sha1 == null ? "" : sha1.name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2199,10 +2199,6 @@ private String launchCommandWithCredentials(
}
}

@SuppressFBWarnings(
value = "DMI_HARDCODED_ABSOLUTE_FILENAME",
justification =
"Path operations below intentionally use absolute '/usr/bin/chcon' and '/sys/fs/selinux/enforce' and '/proc/self/attr/current' at this time (as delivered in relevant popular Linux distros)")
private Boolean fixSELinuxLabel(Path key, String label) {
// returning false means chcon was tried and failed,
// maybe caller needs to retry with other logic
Expand Down Expand Up @@ -2772,15 +2768,10 @@ private String launchCommandIn(ArgumentListBuilder args, File workDir, EnvVars e
return launchCommandIn(args, workDir, environment, TIMEOUT);
}

@SuppressFBWarnings(
value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "earlier readStderr()/readStdout() call prevents null return")
private String readProcessIntoString(Proc process, String encoding, boolean useStderr) throws IOException {
if (useStderr) {
/* process.getStderr reference is the findbugs warning to be suppressed */
return IOUtils.toString(process.getStderr(), encoding);
}
/* process.getStdout reference is the findbugs warning to be suppressed */
return IOUtils.toString(process.getStdout(), encoding);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1612,9 +1612,6 @@ public CloneCommand depth(Integer depth) {
return this;
}

@SuppressFBWarnings(
value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE",
justification = "JGit interaction with spotbugs")
private RepositoryBuilder newRepositoryBuilder() {
RepositoryBuilder builder = new RepositoryBuilder();
builder.setGitDir(new File(workspace, Constants.DOT_GIT)).readEnvironment();
Expand Down Expand Up @@ -3141,7 +3138,6 @@ public String getDefaultRemote(String _default_) throws GitException, Interrupte
/** {@inheritDoc} */
@Deprecated
@Override
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "JGit interaction with spotbugs")
public void setRemoteUrl(String name, String url, String GIT_DIR) throws GitException, InterruptedException {
try (Repository repo =
new RepositoryBuilder().setGitDir(new File(GIT_DIR)).build()) {
Expand Down

0 comments on commit e286c45

Please sign in to comment.