mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-22 00:05:31 +00:00
Fix RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE SpotBugs violations
This commit is contained in:
1 parent
2023494b86
commit
6c45a12cd7
4 files changed
+5
-16
No files matched your search
@@ -815,6 +815,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
|
||||
return state ==State.NOT_STARTED;
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification = "see JENKINS-45892")
|
||||
@Override
|
||||
public String toString() {
|
||||
if (project == null) {
|
||||
|
||||
@@ -2432,11 +2432,6 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
*/
|
||||
public @Nullable String getRootUrl() throws IllegalStateException {
|
||||
final JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
|
||||
if (config == null) {
|
||||
// Try to get standard message if possible
|
||||
final Jenkins j = Jenkins.get();
|
||||
throw new IllegalStateException("Jenkins instance " + j + " has been successfully initialized, but JenkinsLocationConfiguration is undefined.");
|
||||
}
|
||||
String url = config.getUrl();
|
||||
if(url!=null) {
|
||||
return Util.ensureEndsWith(url,"/");
|
||||
@@ -2453,7 +2448,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
||||
@CheckForNull
|
||||
public String getConfiguredRootUrl() {
|
||||
JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
|
||||
return config != null ? config.getUrl() : null;
|
||||
return config.getUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,7 @@ import hudson.widgets.HistoryWidget;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import jenkins.model.RunIdMigrator;
|
||||
@@ -362,10 +363,7 @@ public abstract class LazyBuildMixIn<JobT extends Job<JobT,RunT> & Queue.Task &
|
||||
|
||||
if (r == null) {
|
||||
// having two neighbors pointing to each other is important to make RunMap.removeValue work
|
||||
JobT _parent = asRun().getParent();
|
||||
if (_parent == null) {
|
||||
throw new IllegalStateException("no parent for " + asRun().number);
|
||||
}
|
||||
JobT _parent = Objects.requireNonNull(asRun().getParent(), "no parent for " + asRun().number);
|
||||
RunT pb = _parent.getLazyBuildMixIn()._getRuns().search(asRun().number - 1, AbstractLazyLoadRunMap.Direction.DESC);
|
||||
if (pb != null) {
|
||||
pb.getRunMixIn().nextBuildR = createReference(); // establish bi-di link
|
||||
|
||||
Reference in new issue
Block a user