Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into java11
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 22, 2021
2 parents 67914a2 + a5f13e6 commit b39b105
Show file tree
Hide file tree
Showing 49 changed files with 183 additions and 246 deletions.
9 changes: 6 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ properties([
disableConcurrentBuilds(abortPrevious: true)
])

// TODO: Restore 'Windows' once https://groups.google.com/forum/#!topic/jenkinsci-dev/v9d-XosOp2s is resolved
def buildTypes = ['Linux']
def buildTypes = ['Linux', 'Windows']
def jdks = [11]

def builds = [:]
Expand All @@ -29,7 +28,11 @@ for(j = 0; j < jdks.size(); j++) {
def jdk = jdks[j]
builds["${buildType}-jdk${jdk}"] = {
// see https://github.com/jenkins-infra/documentation/blob/master/ci.adoc#node-labels for information on what node types are available
node(buildType == 'Linux' ? 'maven-11' : buildType.toLowerCase()) {
String agentContainerLabel = 'maven-' + jdk
if (buildType == 'Windows') {
agentContainerLabel += '-windows'
}
node(agentContainerLabel) {
// First stage is actually checking out the source. Since we're using Multibranch
// currently, we can use "checkout scm".
stage('Checkout') {
Expand Down
4 changes: 2 additions & 2 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ THE SOFTWARE.
<dependency> <!-- https://docs.spring.io/spring-security/site/docs/5.4.0-M1/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.6.0</version>
<version>5.6.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -173,7 +173,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
<version>1.15</version>
<version>1.16</version>
</dependency>

<dependency>
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/hudson/ExtensionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
Expand Down Expand Up @@ -327,7 +328,7 @@ private List<ExtensionComponent<T>> ensureLoaded() {
* Chooses the object that locks the loading of the extension instances.
*/
protected Object getLoadLock() {
return jenkins.lookup.setIfNull(Lock.class,new Lock());
return Objects.requireNonNull(jenkins).lookup.setIfNull(Lock.class,new Lock());
}

/**
Expand Down Expand Up @@ -379,7 +380,7 @@ protected List<ExtensionComponent<T>> load() {
LOGGER.log(Level.FINER, String.format("Loading ExtensionList '%s' from", extensionType.getName()), new Throwable("Only present for stacktrace information"));
}

return jenkins.getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
return Objects.requireNonNull(jenkins).getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions core/src/main/java/hudson/PluginWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -972,21 +972,21 @@ public boolean hasLicensesXml() {
if (dependency == null) {
PluginWrapper failedDependency = NOTICE.getPlugin(d.shortName);
if (failedDependency != null) {
dependencyErrors.put(Messages.PluginWrapper_failed_to_load_dependency(failedDependency.getLongName(), failedDependency.getVersion()), true);
dependencyErrors.put(Messages.PluginWrapper_failed_to_load_dependency_2(failedDependency.getLongName(), failedDependency.getShortName(), failedDependency.getVersion()), true);
break;
} else {
dependencyErrors.put(Messages.PluginWrapper_missing(d.shortName, d.version), false);
}
} else {
if (dependency.isActive()) {
if (isDependencyObsolete(d, dependency)) {
versionDependencyError(Messages.PluginWrapper_obsolete(dependency.getLongName(), dependency.getVersion(), d.version), dependency.getVersion(), d.version);
versionDependencyError(Messages.PluginWrapper_obsolete_2(dependency.getLongName(), dependency.getShortName(), dependency.getVersion(), d.version), dependency.getVersion(), d.version);
}
} else {
if (isDependencyObsolete(d, dependency)) {
versionDependencyError(Messages.PluginWrapper_disabledAndObsolete(dependency.getLongName(), dependency.getVersion(), d.version), dependency.getVersion(), d.version);
versionDependencyError(Messages.PluginWrapper_obsolete_2(dependency.getLongName(), dependency.getShortName(), dependency.getVersion(), d.version), dependency.getVersion(), d.version);
} else {
dependencyErrors.put(Messages.PluginWrapper_disabled(dependency.getLongName()), false);
dependencyErrors.put(Messages.PluginWrapper_disabled_2(dependency.getLongName(), dependency.getShortName()), false);
}
}

Expand All @@ -997,7 +997,7 @@ public boolean hasLicensesXml() {
PluginWrapper dependency = parent.getPlugin(d.shortName);
if (dependency != null && dependency.isActive()) {
if (isDependencyObsolete(d, dependency)) {
versionDependencyError(Messages.PluginWrapper_obsolete(dependency.getLongName(), dependency.getVersion(), d.version), dependency.getVersion(), d.version);
versionDependencyError(Messages.PluginWrapper_obsolete_2(dependency.getLongName(), dependency.getShortName(), dependency.getVersion(), d.version), dependency.getVersion(), d.version);
} else {
dependencies.add(d);
}
Expand All @@ -1006,7 +1006,7 @@ public boolean hasLicensesXml() {
if (!dependencyErrors.isEmpty()) {
NOTICE.addPlugin(this);
StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(Messages.PluginWrapper_failed_to_load_plugin(getLongName(), getVersion())).append(System.lineSeparator());
messageBuilder.append(Messages.PluginWrapper_failed_to_load_plugin_2(getLongName(), getShortName(), getVersion())).append(System.lineSeparator());
for (Iterator<String> iterator = dependencyErrors.keySet().iterator(); iterator.hasNext(); ) {
String dependencyError = iterator.next();
messageBuilder.append(" - ").append(dependencyError);
Expand All @@ -1029,7 +1029,7 @@ private boolean isDependencyObsolete(Dependency d, PluginWrapper dependency) {
*/
private void versionDependencyError(String message, String actual, String minimum) {
if (isSnapshot(actual) || isSnapshot(minimum)) {
LOGGER.log(WARNING, "Suppressing dependency error in {0} v{1}: {2}", new Object[] {getLongName(), getVersion(), message});
LOGGER.log(WARNING, "Suppressing dependency error in {0} v{1}: {2}", new Object[] {getShortName(), getVersion(), message});
} else {
dependencyErrors.put(message, false);
}
Expand Down
19 changes: 0 additions & 19 deletions core/src/main/java/hudson/WebAppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
import javax.servlet.ServletContextListener;
import javax.servlet.ServletResponse;
import javax.servlet.SessionTrackingMode;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import jenkins.model.Jenkins;
import jenkins.util.JenkinsJVM;
import jenkins.util.SystemProperties;
Expand Down Expand Up @@ -235,23 +233,6 @@ public Locale get() {
throw new NoTempDir(e);
}

// Tomcat breaks XSLT with JDK 5.0 and onward. Check if that's the case, and if so,
// try to correct it
try {
TransformerFactory.newInstance();
// if this works we are all happy
} catch (TransformerFactoryConfigurationError x) {
// no it didn't.
LOGGER.log(WARNING, "XSLT not configured correctly. Hudson will try to fix this. See https://bz.apache.org/bugzilla/show_bug.cgi?id=40895 for more details",x);
System.setProperty(TransformerFactory.class.getName(),"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
try {
TransformerFactory.newInstance();
LOGGER.info("XSLT is set to the JAXP RI in JRE");
} catch(TransformerFactoryConfigurationError y) {
LOGGER.log(SEVERE, "Failed to correct the problem.");
}
}

installExpressionFactory(event);

context.setAttribute(APP,new HudsonIsLoading());
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/console/ConsoleNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,12 @@ public static void skip(DataInputStream in) throws IOException {
* Preamble of the encoded form. ANSI escape sequence to stop echo back
* plus a few magic characters.
*/
@SuppressFBWarnings(value = "MS_PKGPROTECT", justification = "used in several plugins")
public static final byte[] PREAMBLE = PREAMBLE_STR.getBytes();
/**
* Post amble is the ANSI escape sequence that brings back the echo.
*/
@SuppressFBWarnings(value = "MS_PKGPROTECT", justification = "used in several plugins")
public static final byte[] POSTAMBLE = POSTAMBLE_STR.getBytes();

/**
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/AbstractItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ protected void checkRename(@NonNull String newName) throws Failure {
* Not all the Items need to support this operation, but if you decide to do so,
* you can use this method.
*/
@SuppressFBWarnings(value = "SWL_SLEEP_WITH_LOCK_HELD", justification = "no big deal")
protected void renameTo(final String newName) throws IOException {

if (!isNameEditable()) {
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/AutoCompletionCandidates.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package hudson.model;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.search.Search;
import hudson.search.UserSearchProperty;
import java.io.IOException;
Expand Down Expand Up @@ -108,6 +109,7 @@ public static <T extends Item> AutoCompletionCandidates ofJobNames(final Class<T
* The nearby contextual {@link ItemGroup} to resolve relative job names from.
* @since 1.553
*/
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION", justification = "no big deal")
public static <T extends Item> AutoCompletionCandidates ofJobNames(final Class<T> type, final String value, ItemGroup container) {
final AutoCompletionCandidates candidates = new AutoCompletionCandidates();
class Visitor extends ItemVisitor {
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/Cause.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Util;
import hudson.console.ModelHyperlinkNote;
import hudson.diagnosis.OldDataMonitor;
Expand Down Expand Up @@ -129,6 +130,7 @@ public void print(TaskListener listener) {
*/
@Deprecated
public static class LegacyCodeCause extends Cause {
@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "for backward compatibility")
private StackTraceElement [] stackTrace;
public LegacyCodeCause() {
stackTrace = new Exception().getStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ private static final class BuildChildPaths extends MasterToSlaveCallable<List<Li
* list of {@link Path} represents one child item to be shown
* (this mechanism is used to skip empty intermediate directory.)
*/
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION", justification = "no big deal")
private static List<List<Path>> buildChildPaths(VirtualFile cur, Locale locale) throws IOException {
List<List<Path>> r = new ArrayList<>();

Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/hudson/model/FreeStyleProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.model;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import jenkins.model.Jenkins;
import jenkins.model.item_category.StandaloneProjectsCategory;
Expand Down Expand Up @@ -70,10 +71,12 @@ public DescriptorImpl getDescriptor() {
*/
@Deprecated
@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "MS_PKGPROTECT", justification = "for backward compatibility")
public static /*almost final*/ DescriptorImpl DESCRIPTOR;

@Extension(ordinal=1000) @Symbol({"freeStyle","freeStyleJob"})
public static class DescriptorImpl extends AbstractProjectDescriptor {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/Queue.java
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ public static <V> java.util.concurrent.Callable<V> wrapWithLock(java.util.concur
}

@Override
@SuppressFBWarnings(value = "WA_AWAIT_NOT_IN_LOOP", justification = "the caller does indeed call this method in a loop")
protected void _await() throws InterruptedException {
condition.await();
}
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/model/ResourceController.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package hudson.model;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.util.AdaptedIterator;
import java.util.AbstractCollection;
import java.util.Collection;
Expand Down Expand Up @@ -166,6 +167,7 @@ public ResourceActivity getBlockingActivity(ResourceActivity activity) {
return null;
}

@SuppressFBWarnings(value = "WA_NOT_IN_LOOP", justification = "the caller does indeed call this method in a loop")
protected void _await() throws InterruptedException {
wait();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public String getHelpFile() {
@Override
public ParameterValue createValue(StaplerRequest req, JSONObject jo) {
StringParameterValue value = req.bindJSON(StringParameterValue.class, jo);
if (isTrim() && value!=null) {
if (isTrim()) {
value.doTrim();
}
value.setDescription(getDescription());
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/UpdateCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ public void postValidate(DownloadJob job, File src) throws IOException {
* @throws IOException if there were problems downloading the resource.
* @see DownloadJob
*/
@SuppressFBWarnings(value = "WEAK_MESSAGE_DIGEST_SHA1", justification = "SHA-1 is only used as a fallback if SHA-256/SHA-512 are not available")
public File download(DownloadJob job, URL src) throws IOException {
MessageDigest sha1 = null;
MessageDigest sha256 = null;
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/hudson/node_monitors/ClockMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.node_monitors;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.Computer;
import hudson.model.Node;
Expand Down Expand Up @@ -53,10 +54,12 @@ public ClockDifference getDifferenceFor(Computer c) {
*/
@Deprecated
@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "MS_PKGPROTECT", justification = "for backward compatibility")
public static /*almost final*/ AbstractNodeMonitorDescriptor<ClockDifference> DESCRIPTOR;

@Extension @Symbol("clock")
public static class DescriptorImpl extends AbstractAsyncNodeMonitorDescriptor<ClockDifference> {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/node_monitors/SwapSpaceMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.node_monitors;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.Functions;
import hudson.Util;
Expand Down Expand Up @@ -89,6 +90,7 @@ public String getColumnCaption() {

@Extension @Symbol("swapSpace")
public static class DescriptorImpl extends AbstractAsyncNodeMonitorDescriptor<MemoryUsage> {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.node_monitors;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.FilePath;
import hudson.model.Computer;
Expand Down Expand Up @@ -66,10 +67,12 @@ public String getColumnCaption() {
* Use injection
*/
@Deprecated
@SuppressFBWarnings(value = "MS_PKGPROTECT", justification = "for backward compatibility")
public static /*almost final*/ DiskSpaceMonitorDescriptor DESCRIPTOR;

@Extension @Symbol("tmpSpace")
public static class DescriptorImpl extends DiskSpaceMonitorDescriptor {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/security/ACL.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public String toString() {
*/
public static final Sid ANONYMOUS = new PrincipalSid(ANONYMOUS_USERNAME);

protected static final Sid[] AUTOMATIC_SIDS = new Sid[]{EVERYONE,ANONYMOUS};
static final Sid[] AUTOMATIC_SIDS = new Sid[]{EVERYONE,ANONYMOUS};

/**
* The username for the system user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.security;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.Descriptor;
import java.util.Collections;
Expand Down Expand Up @@ -96,6 +97,7 @@ public void setAllowAnonymousRead(boolean allowAnonymousRead) {

@Extension @Symbol("loggedInUsersCanDoAnything")
public static class DescriptorImpl extends Descriptor<AuthorizationStrategy> {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/security/LegacySecurityRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.security;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.Descriptor;
import java.util.ArrayList;
Expand Down Expand Up @@ -99,6 +100,7 @@ public Filter createFilter(FilterConfig filterConfig) {

@Extension @Symbol("legacy")
public static class DescriptorImpl extends Descriptor<SecurityRealm> {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/slaves/JNLPLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public String getWorkDirOptions(@NonNull Computer computer) {

@Extension @Symbol("jnlp")
public static class DescriptorImpl extends Descriptor<ComputerLauncher> {
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/tasks/Maven.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public static final class DescriptorImpl extends BuildStepDescriptor<Builder> im
@CopyOnWrite
private volatile MavenInstallation[] installations = new MavenInstallation[0];

@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "for backward compatibility")
public DescriptorImpl() {
DESCRIPTOR = this;
}
Expand Down

0 comments on commit b39b105

Please sign in to comment.