From 4b1f8949df6c4ba264440a288c9ebfd5d63085b0 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 29 Nov 2021 08:30:49 -0800 Subject: [PATCH 01/24] Enable `MissingDeprecated` Checkstyle check (#5967) --- core/src/main/java/hudson/PluginManager.java | 1 + core/src/main/java/hudson/PluginWrapper.java | 2 ++ core/src/main/java/hudson/model/ListView.java | 6 +++--- core/src/main/java/hudson/model/Slave.java | 2 +- core/src/main/java/hudson/model/UpdateCenter.java | 1 + core/src/main/java/hudson/model/UpdateSite.java | 4 ++-- core/src/main/java/hudson/model/User.java | 1 + core/src/main/java/hudson/model/queue/Tasks.java | 2 +- core/src/main/java/hudson/slaves/JNLPLauncher.java | 1 + core/src/main/java/hudson/util/RingBufferLogHandler.java | 1 + .../src/main/java/jenkins/ClassLoaderReflectionToolkit.java | 2 ++ core/src/main/java/jenkins/install/InstallState.java | 2 +- core/src/main/java/jenkins/model/Jenkins.java | 2 ++ core/src/main/java/jenkins/security/ApiTokenProperty.java | 3 ++- .../main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java | 5 +++-- .../src/main/java/jenkins/triggers/ReverseBuildTrigger.java | 1 + pom.xml | 3 ++- test/src/test/java/hudson/cli/DisablePluginCommandTest.java | 2 +- test/src/test/java/hudson/diagnosis/OldDataMonitorTest.java | 2 +- 19 files changed, 29 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java index 48a4c6d7a6bb..957f161895d1 100644 --- a/core/src/main/java/hudson/PluginManager.java +++ b/core/src/main/java/hudson/PluginManager.java @@ -854,6 +854,7 @@ private boolean containsHpiJpi(Collection bundledPlugins, String name) { /** * Returns the manifest of a bundled but not-extracted plugin. + * @deprecated removed without replacement */ @Deprecated // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ public @CheckForNull Manifest getBundledPluginManifest(String shortName) { diff --git a/core/src/main/java/hudson/PluginWrapper.java b/core/src/main/java/hudson/PluginWrapper.java index 921d160a66a0..adbb4a6f3a1e 100644 --- a/core/src/main/java/hudson/PluginWrapper.java +++ b/core/src/main/java/hudson/PluginWrapper.java @@ -767,6 +767,7 @@ public void enable() throws IOException { /** * Disables this plugin next time Jenkins runs. As it doesn't check anything, it's recommended to use the method * {@link #disable(PluginDisableStrategy)} + * @deprecated use {@link #disable(PluginDisableStrategy)} */ @Deprecated //see https://issues.jenkins.io/browse/JENKINS-27177 public void disable() throws IOException { @@ -1190,6 +1191,7 @@ public String getBackupVersion() { /** * Checks if this plugin is pinned and that's forcing us to use an older version than the bundled one. + * @deprecated removed without replacement */ @Deprecated // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ public boolean isPinningForcingOldVersion() { diff --git a/core/src/main/java/hudson/model/ListView.java b/core/src/main/java/hudson/model/ListView.java index c91a6a3c0041..02946a4e3cea 100644 --- a/core/src/main/java/hudson/model/ListView.java +++ b/core/src/main/java/hudson/model/ListView.java @@ -105,7 +105,7 @@ public class ListView extends View implements DirectlyModifiableView { /** * Filter by enabled/disabled status of jobs. * Null for no filter, true for enabled-only, false for disabled-only. - * Deprecated see {@link StatusFilter} + * @deprecated Status filter is now controlled via a {@link ViewJobFilter}, see {@link StatusFilter} */ @Deprecated private transient Boolean statusFilter; @@ -333,7 +333,7 @@ public void setRecurse(boolean recurse) { /** * Filter by enabled/disabled status of jobs. * Null for no filter, true for enabled-only, false for disabled-only. - * Status filter is now controlled via a JobViewFilter, see {@link StatusFilter} + * @deprecated Status filter is now controlled via a {@link ViewJobFilter}, see {@link StatusFilter} */ @Deprecated public Boolean getStatusFilter() { @@ -488,7 +488,7 @@ public synchronized void setJobNames(Set jobNames) { } /** - * Deprecated see, {@link StatusFilter} + * @deprecated Status filter is now controlled via a {@link ViewJobFilter}, see {@link StatusFilter} */ @Deprecated @DataBoundSetter diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index 21f9c441f61b..aa0f13e47b8f 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -154,7 +154,7 @@ public abstract class Slave extends Node implements Serializable { new DescribableList<>(this); /** - * Removed with no replacement. + * @deprecated Removed with no replacement. */ @Deprecated private transient String userId; diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index c30f16dc4d30..42eb63377849 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -997,6 +997,7 @@ public List getAvailables() { /** * Returns a list of plugins that should be shown in the "available" tab, grouped by category. * A plugin with multiple categories will appear multiple times in the list. + * @deprecated use {@link #getAvailables()} */ @Deprecated public PluginEntry[] getCategorizedAvailables() { diff --git a/core/src/main/java/hudson/model/UpdateSite.java b/core/src/main/java/hudson/model/UpdateSite.java index 30c13565b8aa..2e17014f1bf8 100644 --- a/core/src/main/java/hudson/model/UpdateSite.java +++ b/core/src/main/java/hudson/model/UpdateSite.java @@ -289,7 +289,7 @@ protected JSONSignatureValidator getJsonSignatureValidator() { /** * Let sub-classes of UpdateSite provide their own signature validator. - * @param name, the name for the JSON signature Validator object. + * @param name the name for the JSON signature Validator object. * if name is null, then the default name will be used, * which is "update site" followed by the update site id * @return the signature validator. @@ -493,7 +493,7 @@ public String getUrl() { /** * URL which exposes the metadata location in a specific update site. - * @param downloadable, the downloadable id of a specific metatadata json (e.g. hudson.tasks.Maven.MavenInstaller.json) + * @param downloadable the downloadable id of a specific metatadata json (e.g. hudson.tasks.Maven.MavenInstaller.json) * @return the location * @since 2.20 */ diff --git a/core/src/main/java/hudson/model/User.java b/core/src/main/java/hudson/model/User.java index 13dd0be8be59..c3012b0db7e7 100644 --- a/core/src/main/java/hudson/model/User.java +++ b/core/src/main/java/hudson/model/User.java @@ -731,6 +731,7 @@ public String toString() { /** * Called by tests in the JTH. Otherwise this shouldn't be called. * Even in the tests this usage is questionable. + * @deprecated removed without replacement */ @Deprecated public static void clear() { diff --git a/core/src/main/java/hudson/model/queue/Tasks.java b/core/src/main/java/hudson/model/queue/Tasks.java index 1824c8f51b36..5fdadcfb2f74 100644 --- a/core/src/main/java/hudson/model/queue/Tasks.java +++ b/core/src/main/java/hudson/model/queue/Tasks.java @@ -53,7 +53,7 @@ public static Object getSameNodeConstraintOf(SubTask t) { return t.getSameNodeConstraint(); } - /** deprecated call {@link SubTask#getOwnerTask} directly */ + /** @deprecated call {@link SubTask#getOwnerTask} directly */ @Deprecated public static @NonNull Task getOwnerTaskOf(@NonNull SubTask t) { return t.getOwnerTask(); diff --git a/core/src/main/java/hudson/slaves/JNLPLauncher.java b/core/src/main/java/hudson/slaves/JNLPLauncher.java index 150f575bf954..fce275c3d75f 100644 --- a/core/src/main/java/hudson/slaves/JNLPLauncher.java +++ b/core/src/main/java/hudson/slaves/JNLPLauncher.java @@ -92,6 +92,7 @@ public class JNLPLauncher extends ComputerLauncher { * If {@code null}, {@link RemotingWorkDirSettings#getEnabledDefaults()} * will be used to enable work directories by default in new agents. * @since 2.68 + * @deprecated use {@link #JNLPLauncher(String, String)} and {@link #setWorkDirSettings(RemotingWorkDirSettings)} */ @Deprecated public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs, @CheckForNull RemotingWorkDirSettings workDirSettings) { diff --git a/core/src/main/java/hudson/util/RingBufferLogHandler.java b/core/src/main/java/hudson/util/RingBufferLogHandler.java index b9fbd8cc238e..9b52436cd3fc 100644 --- a/core/src/main/java/hudson/util/RingBufferLogHandler.java +++ b/core/src/main/java/hudson/util/RingBufferLogHandler.java @@ -45,6 +45,7 @@ public class RingBufferLogHandler extends Handler { /** * This constructor is deprecated. It can't access system properties with {@link jenkins.util.SystemProperties} * as it's not legal to use it on remoting agents. + * @deprecated use {@link #RingBufferLogHandler(int)} */ @Deprecated public RingBufferLogHandler() { diff --git a/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java b/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java index 7b1c8485e742..24a48a0e2250 100644 --- a/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java +++ b/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java @@ -72,6 +72,7 @@ private static class GetClassLoadingLock { * @since 1.553 * @deprecated use {@link #loadClass(ClassLoader, String)} */ + @Deprecated public static @CheckForNull Class _findLoadedClass(ClassLoader cl, String name) { synchronized (getClassLoadingLock(cl, name)) { Class c; @@ -103,6 +104,7 @@ private static class FindLoadedClass { * @since 1.553 * @deprecated use {@link #loadClass(ClassLoader, String)} */ + @Deprecated public static @NonNull Class _findClass(ClassLoader cl, String name) throws ClassNotFoundException { synchronized (getClassLoadingLock(cl, name)) { if (cl instanceof JenkinsClassLoader) { diff --git a/core/src/main/java/jenkins/install/InstallState.java b/core/src/main/java/jenkins/install/InstallState.java index 0e551722362c..f624c7a45af2 100644 --- a/core/src/main/java/jenkins/install/InstallState.java +++ b/core/src/main/java/jenkins/install/InstallState.java @@ -58,7 +58,7 @@ public class InstallState implements ExtensionPoint { * because it is used for serialized state like "jenkins.install.InstallState$4" * before the change from anonymous class to named class. If you need to add a new InstallState, you can just add a new inner named class but nothing to change in this list. * - * @see #readResolve + * @deprecated see {@link #readResolve()} */ @Deprecated @SuppressWarnings("MismatchedReadAndWriteOfArray") diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java index b7cbd877c2bd..1a0cd4d72d71 100644 --- a/core/src/main/java/jenkins/model/Jenkins.java +++ b/core/src/main/java/jenkins/model/Jenkins.java @@ -4878,6 +4878,7 @@ public void doResources(StaplerRequest req, StaplerResponse rsp) throws IOExcept /** * Checks if container uses UTF-8 to decode URLs. See * http://wiki.jenkins-ci.org/display/JENKINS/Tomcat#Tomcat-i18n + * @deprecated use {@link URICheckEncodingMonitor#doCheckURIEncoding(StaplerRequest)} */ @Restricted(NoExternalUse.class) @RestrictedSince("2.37") @@ -4888,6 +4889,7 @@ public FormValidation doCheckURIEncoding(StaplerRequest request) throws IOExcept /** * Does not check when system default encoding is "ISO-8859-1". + * @deprecated use {@link URICheckEncodingMonitor#isCheckEnabled()} */ @Restricted(NoExternalUse.class) @RestrictedSince("2.37") diff --git a/core/src/main/java/jenkins/security/ApiTokenProperty.java b/core/src/main/java/jenkins/security/ApiTokenProperty.java index 183f56251a81..fa72d5a74a42 100644 --- a/core/src/main/java/jenkins/security/ApiTokenProperty.java +++ b/core/src/main/java/jenkins/security/ApiTokenProperty.java @@ -658,13 +658,14 @@ public HttpResponse doRevokeAllExcept(@AncestorInPath User u, } /** - * Only used for legacy API Token generation and change. After that token is revoked, it will be useless. + * @deprecated Only used for legacy API Token generation and change. After that token is revoked, it will be useless. */ @Deprecated private static final SecureRandom RANDOM = new SecureRandom(); /** * We don't want an API key that's too long, so cut the length to 16 (which produces 32-letter MAC code in hexdump) + * @deprecated only used for the migration of previous data */ @Deprecated @Restricted(NoExternalUse.class) diff --git a/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java b/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java index acc4e07aadc1..3e4fd3278681 100644 --- a/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java +++ b/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java @@ -4,9 +4,10 @@ /** * This class was part of the old JNLP1 protocol, which has been removed. - * The {@code SLAVE_SECRET} was still used by some plugins. It has been moved to - * JnlpAgentReceiver as a more suitable location, but this alias retained + * The {@link #SLAVE_SECRET} was still used by some plugins. It has been moved to + * {@link JnlpAgentReceiver} as a more suitable location, but this alias retained * for compatibility. References should be updated to the new location. + * @deprecated use {@link JnlpAgentReceiver#SLAVE_SECRET} */ @Deprecated public class JnlpSlaveAgentProtocol { diff --git a/core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java b/core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java index c2d6b037d8d9..cf18b6362cf2 100644 --- a/core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java +++ b/core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java @@ -95,6 +95,7 @@ public final class ReverseBuildTrigger extends Trigger implements Dependenc /** * Legacy constructor used before {@link #threshold} was moved to a {@code @DataBoundSetter}. Kept around for binary * compatibility. + * @deprecated use {@link #ReverseBuildTrigger(String)} and {@link #setThreshold(Result)} */ @Deprecated public ReverseBuildTrigger(String upstreamProjects, Result threshold) { diff --git a/pom.xml b/pom.xml index f34c810c6af4..f61846b7b567 100644 --- a/pom.xml +++ b/pom.xml @@ -435,8 +435,9 @@ THE SOFTWARE. - + + diff --git a/test/src/test/java/hudson/cli/DisablePluginCommandTest.java b/test/src/test/java/hudson/cli/DisablePluginCommandTest.java index 04931e6f2847..d0d8bb69b678 100644 --- a/test/src/test/java/hudson/cli/DisablePluginCommandTest.java +++ b/test/src/test/java/hudson/cli/DisablePluginCommandTest.java @@ -104,7 +104,7 @@ public void cannotDisableDependentPluginWrongOrderStrategyNone() { } /** - * Can disable a plugin with a mandatory dependent plugin before its dependent plugin with all/i> strategy + * Can disable a plugin with a mandatory dependent plugin before its dependent plugin with all strategy */ @Test @Issue("JENKINS-27177") diff --git a/test/src/test/java/hudson/diagnosis/OldDataMonitorTest.java b/test/src/test/java/hudson/diagnosis/OldDataMonitorTest.java index 6f3c3672d047..ed85208509c5 100644 --- a/test/src/test/java/hudson/diagnosis/OldDataMonitorTest.java +++ b/test/src/test/java/hudson/diagnosis/OldDataMonitorTest.java @@ -91,7 +91,7 @@ public class OldDataMonitorTest { /** * Note that this doesn't actually run slowly, it just ensures that - * the {@link OldDataMonitor#changeListener's onChange()} can complete + * the {@link OldDataMonitor#changeListener}'s {@code onChange()} can complete * while {@link OldDataMonitor#doDiscard(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)} * is still running. * From 82c649ea792704631fb40e85eab297002e075ea1 Mon Sep 17 00:00:00 2001 From: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> Date: Mon, 29 Nov 2021 21:08:07 +0100 Subject: [PATCH 02/24] [JENKINS-67227] Integrate remoting 4.11.2 (#5983) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f61846b7b567..bb356f3f3dc1 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ THE SOFTWARE. https://www.jenkins.io/changelog - 4.11.1 + 4.11.2 3.14 From f4fb34a15ec449836df4a1c2cf773e4b452f217d Mon Sep 17 00:00:00 2001 From: Stefan Spieker Date: Mon, 29 Nov 2021 21:08:36 +0100 Subject: [PATCH 03/24] Removed LargeText which was moved a long time ago to Stapler (#5975) --- .../src/main/java/hudson/model/LargeText.java | 391 ------------------ 1 file changed, 391 deletions(-) delete mode 100644 core/src/main/java/hudson/model/LargeText.java diff --git a/core/src/main/java/hudson/model/LargeText.java b/core/src/main/java/hudson/model/LargeText.java deleted file mode 100644 index df3e95d7b99b..000000000000 --- a/core/src/main/java/hudson/model/LargeText.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package hudson.model; - -import hudson.util.ByteBuffer; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.RandomAccessFile; -import java.io.Reader; -import java.io.Writer; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.io.output.CountingOutputStream; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; -import org.kohsuke.stapler.framework.io.CharSpool; -import org.kohsuke.stapler.framework.io.LineEndNormalizingWriter; -import org.kohsuke.stapler.framework.io.WriterOutputStream; - -/** - * Represents a large text data. - * - *

- * This class defines methods for handling progressive text update. - * - * @author Kohsuke Kawaguchi - * @deprecated moved to stapler, as of Hudson 1.220 - */ -@Deprecated -public class LargeText { - /** - * Represents the data source of this text. - */ - private interface Source { - Session open() throws IOException; - long length(); - boolean exists(); - } - private final Source source; - - private volatile boolean completed; - - public LargeText(final File file, boolean completed) { - this.source = new Source() { - @Override - public Session open() throws IOException { - return new FileSession(file); - } - - @Override - public long length() { - return file.length(); - } - - @Override - public boolean exists() { - return file.exists(); - } - }; - this.completed = completed; - } - - @SuppressWarnings("deprecation") - public LargeText(final ByteBuffer memory, boolean completed) { - this.source = new Source() { - @Override - public Session open() throws IOException { - return new BufferSession(memory); - } - - @Override - public long length() { - return memory.length(); - } - - @Override - public boolean exists() { - return true; - } - }; - this.completed = completed; - } - - public void markAsComplete() { - completed = true; - } - - public boolean isComplete() { - return completed; - } - - /** - * Returns {@link Reader} for reading the raw bytes. - */ - public Reader readAll() throws IOException { - return new InputStreamReader(new InputStream() { - final Session session = source.open(); - @Override - public int read() throws IOException { - byte[] buf = new byte[1]; - int n = session.read(buf); - if(n==1) return buf[0]; - else return -1; // EOF - } - - @Override - public int read(byte[] buf, int off, int len) throws IOException { - return session.read(buf,off,len); - } - - @Override - public void close() throws IOException { - session.close(); - } - }); - } - - /** - * Writes the tail portion of the file to the {@link Writer}. - * - *

- * The text file is assumed to be in the system default encoding. - * - * @param start - * The byte offset in the input file where the write operation starts. - * - * @return - * if the file is still being written, this method writes the file - * until the last newline character and returns the offset to start - * the next write operation. - */ - public long writeLogTo(long start, Writer w) throws IOException { - CountingOutputStream os = new CountingOutputStream(new WriterOutputStream(w)); - - try (Session f = source.open()) { - f.skip(start); - - if (completed) { - // write everything till EOF - byte[] buf = new byte[1024]; - int sz; - while ((sz = f.read(buf)) >= 0) - os.write(buf, 0, sz); - } else { - ByteBuf buf = new ByteBuf(null, f); - HeadMark head = new HeadMark(buf); - TailMark tail = new TailMark(buf); - - while (tail.moveToNextLine(f)) { - head.moveTo(tail, os); - } - head.finish(os); - } - } - os.flush(); - - return os.getCount()+start; - } - - /** - * Implements the progressive text handling. - * This method is used as a "web method" with progressiveText.jelly. - */ - public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException { - rsp.setContentType("text/plain"); - rsp.setStatus(HttpServletResponse.SC_OK); - - if(!source.exists()) { - // file doesn't exist yet - rsp.addHeader("X-Text-Size","0"); - rsp.addHeader("X-More-Data","true"); - return; - } - - long start = 0; - String s = req.getParameter("start"); - if(s!=null) - start = Long.parseLong(s); - - if(source.length() < start ) - start = 0; // text rolled over - - CharSpool spool = new CharSpool(); - long r = writeLogTo(start,spool); - - rsp.addHeader("X-Text-Size",String.valueOf(r)); - if(!completed) - rsp.addHeader("X-More-Data","true"); - - // when sending big text, try compression. don't bother if it's small - Writer w; - if(r-start>4096) - w = rsp.getCompressedWriter(req); - else - w = rsp.getWriter(); - spool.writeTo(new LineEndNormalizingWriter(w)); - w.close(); - - } - - /** - * Points to a byte in the buffer. - */ - private static class Mark { - protected ByteBuf buf; - protected int pos; - - Mark(ByteBuf buf) { - this.buf = buf; - } - } - - /** - * Points to the start of the region that's not committed - * to the output yet. - */ - private static final class HeadMark extends Mark { - HeadMark(ByteBuf buf) { - super(buf); - } - - /** - * Moves this mark to 'that' mark, and writes the data - * to {@link OutputStream} if necessary. - */ - void moveTo(Mark that, OutputStream os) throws IOException { - while(this.buf!=that.buf) { - os.write(buf.buf,0,buf.size); - buf = buf.next; - pos = 0; - } - - this.pos = that.pos; - } - - void finish(OutputStream os) throws IOException { - os.write(buf.buf,0,pos); - } - } - - /** - * Points to the end of the region. - */ - private static final class TailMark extends Mark { - TailMark(ByteBuf buf) { - super(buf); - } - - boolean moveToNextLine(Session f) throws IOException { - while(true) { - while(pos==buf.size) { - if(!buf.isFull()) { - // read until EOF - return false; - } else { - // read into the next buffer - buf = new ByteBuf(buf,f); - pos = 0; - } - } - byte b = buf.buf[pos++]; - if(b=='\r' || b=='\n') - return true; - } - } - } - - private static final class ByteBuf { - private final byte[] buf = new byte[1024]; - private int size = 0; - private ByteBuf next; - - ByteBuf(ByteBuf previous, Session f) throws IOException { - if(previous!=null) { - assert previous.next==null; - previous.next = this; - } - - while(!this.isFull()) { - int chunk = f.read(buf, size, buf.length - size); - if(chunk==-1) - return; - size+= chunk; - } - } - - public boolean isFull() { - return buf.length==size; - } - } - - /** - * Represents the read session of the {@link Source}. - * Methods generally follow the contracts of {@link InputStream}. - */ - private interface Session extends AutoCloseable { - @Override - void close() throws IOException; - void skip(long start) throws IOException; - int read(byte[] buf) throws IOException; - int read(byte[] buf, int offset, int length) throws IOException; - } - - /** - * {@link Session} implementation over {@link RandomAccessFile}. - */ - private static final class FileSession implements Session { - private final RandomAccessFile file; - - FileSession(File file) throws IOException { - this.file = new RandomAccessFile(file,"r"); - } - - @Override - public void close() throws IOException { - file.close(); - } - - @Override - public void skip(long start) throws IOException { - file.seek(file.getFilePointer()+start); - } - - @Override - public int read(byte[] buf) throws IOException { - return file.read(buf); - } - - @Override - public int read(byte[] buf, int offset, int length) throws IOException { - return file.read(buf,offset,length); - } - } - - /** - * {@link Session} implementation over {@link ByteBuffer}. - */ - private static final class BufferSession implements Session { - private final InputStream in; - - @SuppressWarnings("deprecation") - BufferSession(ByteBuffer buf) { - this.in = buf.newInputStream(); - } - - - @Override - public void close() throws IOException { - in.close(); - } - - @Override - public void skip(long n) throws IOException { - while(n>0) - n -= in.skip(n); - } - - @Override - public int read(byte[] buf) throws IOException { - return in.read(buf); - } - - @Override - public int read(byte[] buf, int offset, int length) throws IOException { - return in.read(buf,offset,length); - } - } -} From 3492ee73b582953bbd00d8780feb66a406895d80 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 29 Nov 2021 12:08:48 -0800 Subject: [PATCH 04/24] Remove `sorcerer` (#5960) --- pom.xml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/pom.xml b/pom.xml index bb356f3f3dc1..3110ad612746 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,6 @@ THE SOFTWARE. https://api.github.com jenkins-jira - 0.11 ${skipTests} 8 @@ -644,33 +643,6 @@ THE SOFTWARE. jenkins - - sorcerer - - - - org.kohsuke.sorcerer - maven-sorcerer-plugin - ${sorcerer.version} - - 1.${java.level} - - - - - - - - org.kohsuke.sorcerer - maven-sorcerer-plugin - ${sorcerer.version} - - 1.${java.level} - - - - - release From 3efaa717c827561eb934c4f0ae631b3f4f4e5850 Mon Sep 17 00:00:00 2001 From: Stefan Spieker Date: Mon, 29 Nov 2021 21:09:06 +0100 Subject: [PATCH 05/24] Replaced deprecated CaseInsensitiveComparator with Java built-in (#5771) --- test/src/test/resources/hudson/cli/testview-foo.xml | 2 +- test/src/test/resources/hudson/cli/view.xml | 2 +- .../hudson/model/ListViewTest/migrateStatusFilter/config.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/src/test/resources/hudson/cli/testview-foo.xml b/test/src/test/resources/hudson/cli/testview-foo.xml index 5aae9331cafd..de7f81c1ee13 100644 --- a/test/src/test/resources/hudson/cli/testview-foo.xml +++ b/test/src/test/resources/hudson/cli/testview-foo.xml @@ -5,7 +5,7 @@ false - + core_selenium-test jenkins_lts_branch jenkins_main_maven-3.1.0 diff --git a/test/src/test/resources/hudson/cli/view.xml b/test/src/test/resources/hudson/cli/view.xml index 35c851854470..11282c8b65c9 100644 --- a/test/src/test/resources/hudson/cli/view.xml +++ b/test/src/test/resources/hudson/cli/view.xml @@ -5,7 +5,7 @@ false - + core_selenium-test jenkins_lts_branch jenkins_main_maven-3.1.0 diff --git a/test/src/test/resources/hudson/model/ListViewTest/migrateStatusFilter/config.xml b/test/src/test/resources/hudson/model/ListViewTest/migrateStatusFilter/config.xml index 6e280d2b79de..da8cd8874e18 100644 --- a/test/src/test/resources/hudson/model/ListViewTest/migrateStatusFilter/config.xml +++ b/test/src/test/resources/hudson/model/ListViewTest/migrateStatusFilter/config.xml @@ -32,7 +32,7 @@ false - + From ead588114f2c5122e78fc4e4fcc06215be119147 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Nov 2021 12:09:54 -0800 Subject: [PATCH 06/24] Bump checkstyle from 9.1 to 9.2 (#5987) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3110ad612746..84b575aad667 100644 --- a/pom.xml +++ b/pom.xml @@ -419,7 +419,7 @@ THE SOFTWARE. com.puppycrawl.tools checkstyle - 9.1 + 9.2 From 78626190b9b632e72e5efcafb1e6fccaf69abad0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Nov 2021 20:29:41 +0000 Subject: [PATCH 07/24] Bump junit.jupiter.version from 5.8.1 to 5.8.2 (#5986) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 84b575aad667..17f52916f1de 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ THE SOFTWARE. ${project.basedir}/../src/spotbugs/spotbugs-excludes.xml 1.25 - 5.8.1 + 5.8.2 2.17.4 From 5a975b8841444b69e048eb471c8fa941350f562f Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 29 Nov 2021 12:42:44 -0800 Subject: [PATCH 08/24] Enable `PackageDeclaration` Checkstyle check (#5964) --- pom.xml | 1 + test/src/test/java/{ => jenkins}/CoreJellyTest.java | 1 + test/src/test/java/{ => jenkins}/CorePropertiesTest.java | 1 + 3 files changed, 3 insertions(+) rename test/src/test/java/{ => jenkins}/CoreJellyTest.java (98%) rename test/src/test/java/{ => jenkins}/CorePropertiesTest.java (98%) diff --git a/pom.xml b/pom.xml index 17f52916f1de..6f839a65a8ec 100644 --- a/pom.xml +++ b/pom.xml @@ -450,6 +450,7 @@ THE SOFTWARE. + diff --git a/test/src/test/java/CoreJellyTest.java b/test/src/test/java/jenkins/CoreJellyTest.java similarity index 98% rename from test/src/test/java/CoreJellyTest.java rename to test/src/test/java/jenkins/CoreJellyTest.java index 9827ed163edb..b0d3ea6a500c 100644 --- a/test/src/test/java/CoreJellyTest.java +++ b/test/src/test/java/jenkins/CoreJellyTest.java @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +package jenkins; import hudson.remoting.Which; import jenkins.model.Jenkins; diff --git a/test/src/test/java/CorePropertiesTest.java b/test/src/test/java/jenkins/CorePropertiesTest.java similarity index 98% rename from test/src/test/java/CorePropertiesTest.java rename to test/src/test/java/jenkins/CorePropertiesTest.java index 526e99c42595..7aab2c2ac32c 100644 --- a/test/src/test/java/CorePropertiesTest.java +++ b/test/src/test/java/jenkins/CorePropertiesTest.java @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +package jenkins; import hudson.remoting.Which; import jenkins.model.Jenkins; From 5743280c43c6444dfdd98e3a3b6d6d40365baebd Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 29 Nov 2021 23:50:51 -0800 Subject: [PATCH 09/24] Enable `LineLength` Checkstyle check (#5969) --- .../java/hudson/model/UsageStatistics.java | 7 +- .../jenkins/slaves/JnlpAgentReceiver.java | 3 +- .../java/jenkins/views/PartialHeader.java | 15 +- .../hudson/slaves/ComputerLauncherTest.java | 24 ++- .../hudson/util/ArgumentListBuilderTest.java | 28 ++- .../java/jenkins/model/RunIdMigratorTest.java | 173 ++++++++++++++++-- pom.xml | 5 + .../console/AnnotatedLargeTextTest.java | 38 +++- test/src/test/java/hudson/model/ApiTest.java | 9 +- .../hudson/model/UsageStatisticsTest.java | 26 ++- .../test/java/hudson/security/WhoAmITest.java | 5 +- .../java/jenkins/install/SetupWizardTest.java | 62 ++++++- 12 files changed, 354 insertions(+), 41 deletions(-) diff --git a/core/src/main/java/hudson/model/UsageStatistics.java b/core/src/main/java/hudson/model/UsageStatistics.java index e65d920fb45a..244f17d1d01c 100644 --- a/core/src/main/java/hudson/model/UsageStatistics.java +++ b/core/src/main/java/hudson/model/UsageStatistics.java @@ -290,7 +290,12 @@ private static Cipher toCipher(RSAKey key, int mode) throws GeneralSecurityExcep /** * Public key to encrypt the usage statistics */ - private static final String DEFAULT_KEY_BYTES = "30819f300d06092a864886f70d010101050003818d0030818902818100c14970473bd90fd1f2d20e4fa6e36ea21f7d46db2f4104a3a8f2eb097d6e26278dfadf3fe9ed05bbbb00a4433f4b7151e6683a169182e6ff2f6b4f2bb6490b2cddef73148c37a2a7421fc75f99fb0fadab46f191806599a208652f4829fd6f76e13195fb81ff3f2fce15a8e9a85ebe15c07c90b34ebdb416bd119f0d74105f3b0203010001"; + private static final String DEFAULT_KEY_BYTES = + "30819f300d06092a864886f70d010101050003818d0030818902818100c14970473bd90fd1f2d20e" + + "4fa6e36ea21f7d46db2f4104a3a8f2eb097d6e26278dfadf3fe9ed05bbbb00a4433f4b7151e6683a" + + "169182e6ff2f6b4f2bb6490b2cddef73148c37a2a7421fc75f99fb0fadab46f191806599a208652f" + + "4829fd6f76e13195fb81ff3f2fce15a8e9a85ebe15c07c90b34ebdb416bd119f0d74105f3b020301" + + "0001"; private static final long DAY = DAYS.toMillis(1); diff --git a/core/src/main/java/jenkins/slaves/JnlpAgentReceiver.java b/core/src/main/java/jenkins/slaves/JnlpAgentReceiver.java index 8d137f132bdd..fbea82b0d272 100644 --- a/core/src/main/java/jenkins/slaves/JnlpAgentReceiver.java +++ b/core/src/main/java/jenkins/slaves/JnlpAgentReceiver.java @@ -20,7 +20,8 @@ *

    *
  • When the {@link jenkins.slaves.JnlpAgentReceiver#exists(String)} method is invoked for an agent, the {@link jenkins.slaves.JnlpAgentReceiver#owns(String)} method is called on all the extension points: if no owner is found an exception is thrown.
  • - *
  • If owner is found, then the {@link org.jenkinsci.remoting.engine.JnlpConnectionState} lifecycle methods are invoked for all registered {@link JnlpConnectionStateListener} until the one which changes the state of {@link org.jenkinsci.remoting.engine.JnlpConnectionState} by setting an approval or rejected state is found. + *
  • If owner is found, then the {@link org.jenkinsci.remoting.engine.JnlpConnectionState} lifecycle methods are invoked for all registered {@link JnlpConnectionStateListener} + * until the one which changes the state of {@link org.jenkinsci.remoting.engine.JnlpConnectionState} by setting an approval or rejected state is found. * When found, that listener will be set as the owner of the incoming connection event.
  • *
  • Subsequent steps of the connection lifecycle are only called on the {@link JnlpAgentReceiver} implementation owner for that connection event.
  • *
diff --git a/core/src/main/java/jenkins/views/PartialHeader.java b/core/src/main/java/jenkins/views/PartialHeader.java index 043cef2addcb..a35eae887840 100644 --- a/core/src/main/java/jenkins/views/PartialHeader.java +++ b/core/src/main/java/jenkins/views/PartialHeader.java @@ -42,8 +42,17 @@ public final boolean isCompatible() { @SuppressWarnings("unused") public static void incompatibleHeaders() { ExtensionList.lookup(PartialHeader.class).stream().filter(h -> !h.isCompatible()).forEach(header -> { - LOGGER.warning(String.format("%s:%s not compatible with %s", header.getClass().getName(), header.getSupportedHeaderVersion(), compatibilityHeaderVersion)); - new AdministrativeError(header.getClass().getName(), "Incompatible Header", String.format("The plugin %s is attempting to replace the Jenkins header but is not compatible with this version of Jenkins. The plugin should be updated or removed.", Jenkins.get().getPluginManager().whichPlugin(header.getClass())), null); + LOGGER.warning(String.format( + "%s:%s not compatible with %s", + header.getClass().getName(), + header.getSupportedHeaderVersion(), + compatibilityHeaderVersion)); + new AdministrativeError( + header.getClass().getName(), + "Incompatible Header", + String.format("The plugin %s is attempting to replace the Jenkins header but is not compatible with this version of Jenkins. The plugin should be updated or removed.", + Jenkins.get().getPluginManager().whichPlugin(header.getClass())), + null); }); } -} \ No newline at end of file +} diff --git a/core/src/test/java/hudson/slaves/ComputerLauncherTest.java b/core/src/test/java/hudson/slaves/ComputerLauncherTest.java index 6dbdddad163c..8bf73740da62 100644 --- a/core/src/test/java/hudson/slaves/ComputerLauncherTest.java +++ b/core/src/test/java/hudson/slaves/ComputerLauncherTest.java @@ -51,11 +51,31 @@ public class ComputerLauncherTest { } @Test public void jdk5() { - assertThrows(IOException.class, () -> ComputerLauncher.checkJavaVersion(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM), "-", new BufferedReader(new StringReader("java version \"1.5.0_22\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)\nJava HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)\n")))); + assertThrows( + IOException.class, + () -> + ComputerLauncher.checkJavaVersion( + new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM), + "-", + new BufferedReader( + new StringReader( + "java version \"1.5.0_22\"\n" + + "Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)\n" + + "Java HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)\n")))); } @Test public void j2sdk4() { - assertThrows(IOException.class, () -> ComputerLauncher.checkJavaVersion(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM), "-", new BufferedReader(new StringReader("java version \"1.4.2_19\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)\nJava HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)\n")))); + assertThrows( + IOException.class, + () -> + ComputerLauncher.checkJavaVersion( + new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM), + "-", + new BufferedReader( + new StringReader( + "java version \"1.4.2_19\"\n" + + "Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)\n" + + "Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)\n")))); } @Test public void jdk8() throws IOException { diff --git a/core/src/test/java/hudson/util/ArgumentListBuilderTest.java b/core/src/test/java/hudson/util/ArgumentListBuilderTest.java index 0c437c8e7f21..09b9d207bc3e 100644 --- a/core/src/test/java/hudson/util/ArgumentListBuilderTest.java +++ b/core/src/test/java/hudson/util/ArgumentListBuilderTest.java @@ -132,9 +132,19 @@ public void testToWindowsCommand() { // Try to hide password builder.add("-Dpassword=hidden", true); // By default, does not escape %VAR% - assertThat(builder.toWindowsCommand().toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %QED% %comspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"" )); + assertThat(builder.toWindowsCommand().toString(), is( + "cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" " + + "\"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" " + + "\"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" " + + "\"\"-Dfoo8=% %QED% %comspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** " + + "&& exit %%ERRORLEVEL%%\"")); // Pass flag to escape %VAR% - assertThat(builder.toWindowsCommand(true).toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"")); + assertThat(builder.toWindowsCommand(true).toString(), is( + "cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" " + + "\"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" " + + "\"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" " + + "\"\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** " + + "&& exit %%ERRORLEVEL%%\"")); } @Test @@ -151,9 +161,19 @@ public void testToWindowsCommandMasked() { add("-Dfoo9=%'''%%@%"). // no quotes as none of the % are followed by a letter add("-Dpassword=hidden", true); // By default, does not escape %VAR% - assertThat(builder.toWindowsCommand().toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %QED% %comspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"" )); + assertThat(builder.toWindowsCommand().toString(), is( + "cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" " + + "\"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" " + + "\"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" " + + "\"\"-Dfoo8=% %QED% %comspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** " + + "&& exit %%ERRORLEVEL%%\"")); // Pass flag to escape %VAR% - assertThat(builder.toWindowsCommand(true).toString(), is("cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" \"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" \"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" \"\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** && exit %%ERRORLEVEL%%\"")); + assertThat(builder.toWindowsCommand(true).toString(), is( + "cmd.exe /C \"ant.bat -Dfoo1=abc \"\"-Dfoo2=foo bar\"\" \"-Dfoo3=/u*r\" " + + "\"-Dfoo4=/us?\" \"-Dfoo10=bar,baz\" \"-Dfoo5=foo;bar^baz\" " + + "\"-Dfoo6=&here;\" \"-Dfoo7=foo|bar\"\"baz\" " + + "\"\"-Dfoo8=% %\"Q\"ED% %\"c\"omspec% %-%(%.%\"\" -Dfoo9=%'''%%@% ****** " + + "&& exit %%ERRORLEVEL%%\"")); } @Test diff --git a/core/src/test/java/jenkins/model/RunIdMigratorTest.java b/core/src/test/java/jenkins/model/RunIdMigratorTest.java index c544aeb6402d..06950198391f 100644 --- a/core/src/test/java/jenkins/model/RunIdMigratorTest.java +++ b/core/src/test/java/jenkins/model/RunIdMigratorTest.java @@ -94,13 +94,36 @@ public class RunIdMigratorTest { @Test public void legacy() throws Exception { assumeFalse("Symlinks don't work well on Windows", Functions.isWindows()); - write("2014-01-02_03-04-05/build.xml", "\n\n ok\n 99\n ok\n"); + write( + "2014-01-02_03-04-05/build.xml", + "\n" + + "\n" + + " ok\n" + + " 99\n" + + " ok\n" + + ""); link("99", "2014-01-02_03-04-05"); link("lastFailedBuild", "-1"); link("lastSuccessfulBuild", "99"); - assertEquals("{2014-01-02_03-04-05={build.xml='\n\n ok\n 99\n ok\n'}, 99=→2014-01-02_03-04-05, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", summarize()); + assertEquals( + "{2014-01-02_03-04-05={build.xml='\n" + + "\n" + + " ok\n" + + " 99\n" + + " ok\n" + + "'}, 99=→2014-01-02_03-04-05, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", + summarize()); assertTrue(migrator.migrate(dir, null)); - assertEquals("{99={build.xml='\n\n ok\n 2014-01-02_03-04-05\n 1388649845000\n ok\n'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-05 99\n'}", summarize()); + assertEquals( + "{99={build.xml='\n" + + "\n" + + " ok\n" + + " 2014-01-02_03-04-05\n" + + " 1388649845000\n" + + " ok\n" + + "'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-05 99\n" + + "'}", + summarize()); assertEquals(99, migrator.findNumber("2014-01-02_03-04-05")); migrator = new RunIdMigrator(); assertFalse(migrator.migrate(dir, null)); @@ -115,58 +138,172 @@ public class RunIdMigratorTest { assumeFalse("Symlinks don't work well on Windows", Functions.isWindows()); write("2014-01-02_03-04-04/build.xml", "\n 98\n"); link("98", "2014-01-02_03-04-04"); - write("99/build.xml", "\n\n ok\n 1388649845000\n ok\n"); + write( + "99/build.xml", + "\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + ""); link("lastFailedBuild", "-1"); link("lastSuccessfulBuild", "99"); - assertEquals("{2014-01-02_03-04-04={build.xml='\n 98\n'}, 98=→2014-01-02_03-04-04, 99={build.xml='\n\n ok\n 1388649845000\n ok\n'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", summarize()); + assertEquals( + "{2014-01-02_03-04-04={build.xml='\n" + + " 98\n" + + "'}, 98=→2014-01-02_03-04-04, 99={build.xml='\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + "'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", + summarize()); assertTrue(migrator.migrate(dir, null)); - assertEquals("{98={build.xml='\n 2014-01-02_03-04-04\n 1388649844000\n'}, 99={build.xml='\n\n ok\n 1388649845000\n ok\n'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-04 98\n'}", summarize()); + assertEquals( + "{98={build.xml='\n" + + " 2014-01-02_03-04-04\n" + + " 1388649844000\n" + + "'}, 99={build.xml='\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + "'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-04 98\n" + + "'}", + summarize()); } @Test public void reverseImmediately() throws Exception { assumeFalse("Symlinks don't work well on Windows", Functions.isWindows()); File root = dir; dir = new File(dir, "jobs/somefolder/jobs/someproject/promotions/OK/builds"); - write("99/build.xml", "\n\n ok\n 2014-01-02_03-04-05\n 1388649845000\n ok\n"); + write( + "99/build.xml", + "\n" + + "\n" + + " ok\n" + + " 2014-01-02_03-04-05\n" + + " 1388649845000\n" + + " ok\n" + + ""); link("lastFailedBuild", "-1"); link("lastSuccessfulBuild", "99"); write("legacyIds", "2014-01-02_03-04-05 99\n"); - assertEquals("{99={build.xml='\n\n ok\n 2014-01-02_03-04-05\n 1388649845000\n ok\n'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-05 99\n'}", summarize()); + assertEquals( + "{99={build.xml='\n" + + "\n" + + " ok\n" + + " 2014-01-02_03-04-05\n" + + " 1388649845000\n" + + " ok\n" + + "'}, lastFailedBuild=→-1, lastSuccessfulBuild=→99, legacyIds='2014-01-02_03-04-05 99\n" + + "'}", + summarize()); RunIdMigrator.main(root.getAbsolutePath()); - assertEquals("{2014-01-02_03-04-05={build.xml='\n\n ok\n 99\n ok\n'}, 99=→2014-01-02_03-04-05, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", summarize()); + assertEquals( + "{2014-01-02_03-04-05={build.xml='\n" + + "\n" + + " ok\n" + + " 99\n" + + " ok\n" + + "'}, 99=→2014-01-02_03-04-05, lastFailedBuild=→-1, lastSuccessfulBuild=→99}", + summarize()); } @Test public void reverseAfterNewBuilds() throws Exception { assumeFalse("Symlinks don't work well on Windows", Functions.isWindows()); File root = dir; dir = new File(dir, "jobs/someproject/modules/test$test/builds"); - write("1/build.xml", "\n\n ok\n 1388649845000\n ok\n"); + write( + "1/build.xml", + "\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + ""); write("legacyIds", ""); - assertEquals("{1={build.xml='\n\n ok\n 1388649845000\n ok\n'}, legacyIds=''}", summarize()); + assertEquals( + "{1={build.xml='\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + "'}, legacyIds=''}", + summarize()); RunIdMigrator.main(root.getAbsolutePath()); - assertEquals("{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n\n ok\n 1\n ok\n'}}", summarize()); + assertEquals( + "{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n" + + "\n" + + " ok\n" + + " 1\n" + + " ok\n" + + "'}}", + summarize()); } @Test public void reverseMatrixAfterNewBuilds() throws Exception { assumeFalse("Symlinks don't work well on Windows", Functions.isWindows()); File root = dir; dir = new File(dir, "jobs/someproject/Environment=prod/builds"); - write("1/build.xml", "\n\n ok\n 1388649845000\n ok\n"); + write( + "1/build.xml", + "\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + ""); write("legacyIds", ""); - assertEquals("{1={build.xml='\n\n ok\n 1388649845000\n ok\n'}, legacyIds=''}", summarize()); + assertEquals( + "{1={build.xml='\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + "'}, legacyIds=''}", + summarize()); RunIdMigrator.main(root.getAbsolutePath()); - assertEquals("{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n\n ok\n 1\n ok\n'}}", summarize()); + assertEquals( + "{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n" + + "\n" + + " ok\n" + + " 1\n" + + " ok\n" + + "'}}", + summarize()); } @Test public void reverseMavenAfterNewBuilds() throws Exception { assumeFalse("Symlinks don't work well on Windows", Functions.isWindows()); File root = dir; dir = new File(dir, "jobs/someproject/test$test/builds"); - write("1/build.xml", "\n\n ok\n 1388649845000\n ok\n"); + write( + "1/build.xml", + "\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + ""); write("legacyIds", ""); - assertEquals("{1={build.xml='\n\n ok\n 1388649845000\n ok\n'}, legacyIds=''}", summarize()); + assertEquals( + "{1={build.xml='\n" + + "\n" + + " ok\n" + + " 1388649845000\n" + + " ok\n" + + "'}, legacyIds=''}", + summarize()); RunIdMigrator.main(root.getAbsolutePath()); - assertEquals("{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n\n ok\n 1\n ok\n'}}", summarize()); + assertEquals( + "{1=→2014-01-02_03-04-05, 2014-01-02_03-04-05={build.xml='\n" + + "\n" + + " ok\n" + + " 1\n" + + " ok\n" + + "'}}", + summarize()); } // TODO test sane recovery from various error conditions diff --git a/pom.xml b/pom.xml index 6f839a65a8ec..581ed6baf4c6 100644 --- a/pom.xml +++ b/pom.xml @@ -430,6 +430,11 @@ THE SOFTWARE. + + + + + + diff --git a/test/src/test/java/hudson/security/csrf/DefaultCrumbIssuerTest.java b/test/src/test/java/hudson/security/csrf/DefaultCrumbIssuerTest.java index 11fa962f6d7a..f86ee94a288a 100644 --- a/test/src/test/java/hudson/security/csrf/DefaultCrumbIssuerTest.java +++ b/test/src/test/java/hudson/security/csrf/DefaultCrumbIssuerTest.java @@ -53,7 +53,7 @@ public class DefaultCrumbIssuerTest { "10.2.3.1", "10.2.3.1,10.20.30.40", "10.2.3.1,10.20.30.41", - "10.2.3.3,10.20.30.40,10.20.30.41" + "10.2.3.3,10.20.30.40,10.20.30.41", }; private static final String HEADER_NAME = "X-Forwarded-For"; diff --git a/test/src/test/java/hudson/tasks/FingerprinterTest.java b/test/src/test/java/hudson/tasks/FingerprinterTest.java index ea1172a51d60..ffa5a087326f 100644 --- a/test/src/test/java/hudson/tasks/FingerprinterTest.java +++ b/test/src/test/java/hudson/tasks/FingerprinterTest.java @@ -71,24 +71,24 @@ @SuppressWarnings("rawtypes") public class FingerprinterTest { private static final String[] singleContents = { - "abcdef" + "abcdef", }; private static final String[] singleFiles = { - "test.txt" + "test.txt", }; private static final String[] singleContents2 = { - "ghijkl" + "ghijkl", }; private static final String[] singleFiles2 = { - "test2.txt" + "test2.txt", }; private static final String[] doubleContents = { "abcdef", - "ghijkl" + "ghijkl", }; private static final String[] doubleFiles = { "test.txt", - "test2.txt" + "test2.txt", }; private static final String renamedProject1 = "renamed project 1"; diff --git a/test/src/test/java/hudson/util/ArgumentListBuilder2Test.java b/test/src/test/java/hudson/util/ArgumentListBuilder2Test.java index 86814a46f2dc..8aef1d53c9f7 100644 --- a/test/src/test/java/hudson/util/ArgumentListBuilder2Test.java +++ b/test/src/test/java/hudson/util/ArgumentListBuilder2Test.java @@ -83,9 +83,36 @@ public void ensureArgumentsArePassedViaCmdExeUnmodified() throws Exception { assumeTrue(Functions.isWindows()); String[] specials = new String[] { - "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", - "_", "+", "{", "}", "[", "]", ":", ";", "\"", "'", "\\", "|", - "<", ">", ",", ".", "/", "?", " " + "~", + "!", + "@", + "#", + "$", + "%", + "^", + "&", + "*", + "(", + ")", + "_", + "+", + "{", + "}", + "[", + "]", + ":", + ";", + "\"", + "'", + "\\", + "|", + "<", + ">", + ",", + ".", + "/", + "?", + " ", }; String out = echoArgs(specials); diff --git a/test/src/test/java/jenkins/model/JenkinsTest.java b/test/src/test/java/jenkins/model/JenkinsTest.java index 1729dcc5aa1d..13de45a1698f 100644 --- a/test/src/test/java/jenkins/model/JenkinsTest.java +++ b/test/src/test/java/jenkins/model/JenkinsTest.java @@ -247,7 +247,8 @@ public void testDoCheckDisplayNameSameAsJobName() throws Exception { @Test public void testDoCheckViewName_GoodName() throws Exception { String[] viewNames = new String[] { - "", "Jenkins" + "", + "Jenkins", }; Jenkins jenkins = Jenkins.get(); @@ -260,8 +261,16 @@ public void testDoCheckViewName_GoodName() throws Exception { @Test public void testDoCheckViewName_NotGoodName() throws Exception { String[] viewNames = new String[] { - "Jenkins?", "Jenkins*", "Jenkin/s", "Jenkin\\s", "jenkins%", - "Jenkins!", "Jenkins[]", "Jenkin<>s", "^Jenkins", ".." + "Jenkins?", + "Jenkins*", + "Jenkin/s", + "Jenkin\\s", + "jenkins%", + "Jenkins!", + "Jenkins[]", + "Jenkin<>s", + "^Jenkins", + "..", }; Jenkins jenkins = Jenkins.get(); diff --git a/test/src/test/java/jenkins/security/stapler/GetterMethodFilterTest.java b/test/src/test/java/jenkins/security/stapler/GetterMethodFilterTest.java index 8127b28f342f..c4fe7190d89a 100644 --- a/test/src/test/java/jenkins/security/stapler/GetterMethodFilterTest.java +++ b/test/src/test/java/jenkins/security/stapler/GetterMethodFilterTest.java @@ -155,8 +155,11 @@ public Point[] getArrayOfPoint() { } public Renderable[][] getArrayOfArray() { - return new Renderable[][]{ - new Renderable[]{new Renderable(), new Renderable()} + return new Renderable[][] { + new Renderable[] { + new Renderable(), + new Renderable(), + }, }; } From 74c73dd4ce62f27fdea697ab9728458ece2c1948 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 30 Nov 2021 04:50:24 -0800 Subject: [PATCH 11/24] Enable `MissingSwitchDefault` Checkstyle check (#5966) --- cli/src/main/java/hudson/util/QuotedStringTokenizer.java | 3 +++ core/src/main/java/hudson/cli/ListChangesCommand.java | 2 ++ core/src/main/java/hudson/console/ConsoleAnnotator.java | 3 +-- core/src/main/java/hudson/model/Run.java | 4 ++-- core/src/main/java/hudson/model/UpdateCenter.java | 2 ++ core/src/main/java/hudson/util/jna/RegistryKey.java | 4 +++- .../tasks/filters/impl/RetainVariablesLocalRule.java | 2 ++ .../main/java/jenkins/util/JSONSignatureValidator.java | 8 ++++++-- core/src/main/java/org/jenkins/ui/icon/IconType.java | 4 ++-- pom.xml | 1 + 10 files changed, 24 insertions(+), 9 deletions(-) diff --git a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java index 665126f1cca7..6b8a6f43f781 100644 --- a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java +++ b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java @@ -269,6 +269,9 @@ else if (c=='\\') else _token.append(c); continue; + + default: + break; } } diff --git a/core/src/main/java/hudson/cli/ListChangesCommand.java b/core/src/main/java/hudson/cli/ListChangesCommand.java index b282459b173e..618e4d93346c 100644 --- a/core/src/main/java/hudson/cli/ListChangesCommand.java +++ b/core/src/main/java/hudson/cli/ListChangesCommand.java @@ -88,6 +88,8 @@ protected int act(List> builds) throws IOException { } } break; + default: + throw new AssertionError("Unknown format: " + format); } return 0; diff --git a/core/src/main/java/hudson/console/ConsoleAnnotator.java b/core/src/main/java/hudson/console/ConsoleAnnotator.java index a5c866a5a207..9761439320fe 100644 --- a/core/src/main/java/hudson/console/ConsoleAnnotator.java +++ b/core/src/main/java/hudson/console/ConsoleAnnotator.java @@ -126,9 +126,8 @@ public static ConsoleAnnotator combine(Collection(all); } - - return new ConsoleAnnotatorAggregator<>(all); } /** diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 0923563af633..55ad30782bbd 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -2233,9 +2233,9 @@ public abstract static class StatusSummarizer implements ExtensionPoint { case FIXED : return new Summary(false, Messages.Run_Summary_BackToNormal()); + default: + return new Summary(false, Messages.Run_Summary_Unknown()); } - - return new Summary(false, Messages.Run_Summary_Unknown()); } /** diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index 42eb63377849..da936be626c4 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -2086,6 +2086,8 @@ private static void throwVerificationFailure(String expected, String actual, Fil throw new IOException("Failed to compute SHA-1 of downloaded file, refusing installation"); case NOT_PROVIDED: throw new IOException("Unable to confirm integrity of downloaded file, refusing installation"); + default: + throw new AssertionError("Unknown verification result: " + result1); } } diff --git a/core/src/main/java/hudson/util/jna/RegistryKey.java b/core/src/main/java/hudson/util/jna/RegistryKey.java index aa676b8fa492..f0d7280766cc 100644 --- a/core/src/main/java/hudson/util/jna/RegistryKey.java +++ b/core/src/main/java/hudson/util/jna/RegistryKey.java @@ -105,8 +105,10 @@ private byte[] getValue(String valueName) { case WINERROR.ERROR_SUCCESS: return lpData; + + default: + throw new JnaException(r); } - throw new JnaException(r); } } diff --git a/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java b/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java index f22deec8421d..ee867332cfbf 100644 --- a/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java +++ b/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java @@ -155,6 +155,8 @@ public void filter(@NonNull EnvVars envVars, @NonNull EnvVarsFilterRuleContext c variablesRemoved.add(variableName); iterator.remove(); break; + default: + throw new AssertionError("Unknown process variables handling: " + processVariablesHandling); } } } diff --git a/core/src/main/java/jenkins/util/JSONSignatureValidator.java b/core/src/main/java/jenkins/util/JSONSignatureValidator.java index 2c6ffac991ff..274c0cb96cd9 100644 --- a/core/src/main/java/jenkins/util/JSONSignatureValidator.java +++ b/core/src/main/java/jenkins/util/JSONSignatureValidator.java @@ -105,7 +105,9 @@ public FormValidation verifySignature(JSONObject o) throws IOException { LOGGER.log(Level.INFO, "JSON data source '" + name + "' does not provide a SHA-512 content checksum or signature. Looking for SHA-1."); break; case OK: - // fall through + break; + default: + throw new AssertionError("Unknown form validation kind: " + resultSha512.kind); } } catch (NoSuchAlgorithmException nsa) { LOGGER.log(Level.WARNING, "Failed to verify potential SHA-512 digest/signature, falling back to SHA-1", nsa); @@ -127,7 +129,9 @@ public FormValidation verifySignature(JSONObject o) throws IOException { return FormValidation.error("No correct_signature or correct_signature512 entry found in '" + name + "'."); } case OK: - // fall through + break; + default: + throw new AssertionError("Unknown form validation kind: " + resultSha1.kind); } if (warning!=null) return warning; diff --git a/core/src/main/java/org/jenkins/ui/icon/IconType.java b/core/src/main/java/org/jenkins/ui/icon/IconType.java index 5c80acf9903e..54b2cdba3331 100644 --- a/core/src/main/java/org/jenkins/ui/icon/IconType.java +++ b/core/src/main/java/org/jenkins/ui/icon/IconType.java @@ -54,8 +54,8 @@ public String toQualifiedUrl(String url, JellyContext context) { case PLUGIN: { return resURL + "/plugin/" + url; } + default: + throw new AssertionError("Unknown icon type: " + this); } - - return null; } } diff --git a/pom.xml b/pom.xml index 05053de07f9c..51cafc5d70cc 100644 --- a/pom.xml +++ b/pom.xml @@ -454,6 +454,7 @@ THE SOFTWARE. + From 17298f99d92a6296d6df1116d3840db035a41ef1 Mon Sep 17 00:00:00 2001 From: Jenkins Release Bot <66998184+jenkins-release-bot@users.noreply.github.com> Date: Tue, 30 Nov 2021 16:52:47 +0000 Subject: [PATCH 12/24] [maven-release-plugin] prepare release jenkins-2.323 --- bom/pom.xml | 2 +- cli/pom.xml | 2 +- core/pom.xml | 2 +- pom.xml | 4 ++-- test/pom.xml | 2 +- war/pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index d57d6aced5e3..a19f9c7992f1 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -28,7 +28,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - ${revision}${changelist} + 2.323 jenkins-bom diff --git a/cli/pom.xml b/cli/pom.xml index 3838594a564f..7b04cb733f4e 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -5,7 +5,7 @@ org.jenkins-ci.main jenkins-parent - ${revision}${changelist} + 2.323 cli diff --git a/core/pom.xml b/core/pom.xml index 7af7df22c56d..be256d41704c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -29,7 +29,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - ${revision}${changelist} + 2.323 jenkins-core diff --git a/pom.xml b/pom.xml index 51cafc5d70cc..5393e956e1a4 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - ${revision}${changelist} + 2.323 pom Jenkins main module @@ -61,7 +61,7 @@ THE SOFTWARE. scm:git:git://github.com/jenkinsci/jenkins.git scm:git:ssh://git@github.com/jenkinsci/jenkins.git https://github.com/jenkinsci/jenkins - ${scmTag} + jenkins-2.323 diff --git a/test/pom.xml b/test/pom.xml index 9a28e82d1dd1..9818ad6f39c4 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -28,7 +28,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - ${revision}${changelist} + 2.323 jenkins-test diff --git a/war/pom.xml b/war/pom.xml index 413436828bda..d062baecf1c4 100644 --- a/war/pom.xml +++ b/war/pom.xml @@ -28,7 +28,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - ${revision}${changelist} + 2.323 jenkins-war From eb87a6d2a3e601954429c73d6ed5ffbba5213578 Mon Sep 17 00:00:00 2001 From: Jenkins Release Bot <66998184+jenkins-release-bot@users.noreply.github.com> Date: Tue, 30 Nov 2021 16:53:04 +0000 Subject: [PATCH 13/24] [maven-release-plugin] prepare for next development iteration --- bom/pom.xml | 2 +- cli/pom.xml | 2 +- core/pom.xml | 2 +- pom.xml | 6 +++--- test/pom.xml | 2 +- war/pom.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index a19f9c7992f1..d57d6aced5e3 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -28,7 +28,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - 2.323 + ${revision}${changelist} jenkins-bom diff --git a/cli/pom.xml b/cli/pom.xml index 7b04cb733f4e..3838594a564f 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -5,7 +5,7 @@ org.jenkins-ci.main jenkins-parent - 2.323 + ${revision}${changelist} cli diff --git a/core/pom.xml b/core/pom.xml index be256d41704c..7af7df22c56d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -29,7 +29,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - 2.323 + ${revision}${changelist} jenkins-core diff --git a/pom.xml b/pom.xml index 5393e956e1a4..ab091fe5d7a3 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ THE SOFTWARE. org.jenkins-ci.main jenkins-parent - 2.323 + ${revision}${changelist} pom Jenkins main module @@ -61,7 +61,7 @@ THE SOFTWARE. scm:git:git://github.com/jenkinsci/jenkins.git scm:git:ssh://git@github.com/jenkinsci/jenkins.git https://github.com/jenkinsci/jenkins - jenkins-2.323 + ${scmTag} @@ -70,7 +70,7 @@ THE SOFTWARE. - 2.323 + 2.324 -SNAPSHOT - - - - - - - -

${%Failed to load JNA}

-

${%blurb}

-
${it.stackTraceString}
-
-
-
diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index.properties deleted file mode 100644 index ad290ababa30..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index.properties +++ /dev/null @@ -1,24 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -blurb=Another instance of JNA is already loaded in another classloader, thereby making it impossible for Jenkins \ - to load its own copy. See Wiki for more details. diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_bg.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_bg.properties deleted file mode 100644 index 3e8437e086c5..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_bg.properties +++ /dev/null @@ -1,31 +0,0 @@ -# The MIT License -# -# Bulgarian translation: Copyright (c) 2016, 2017, Alexander Shopov -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Failed\ to\ load\ JNA=\ - JNA \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0441\u0435 \u0437\u0430\u0440\u0435\u0434\u0438 -# Another instance of JNA is already loaded in another classloader, thereby making it impossible for Jenkins \ -# to load its own copy. See Wiki for more details. -blurb=\ - JNA \u0432\u0435\u0447\u0435 \u0435 \u0437\u0430\u0440\u0435\u0434\u0435\u043d \u043e\u0442 \u0434\u0440\u0443\u0433 \u043a\u043b\u0430\u0441 \u0437\u0430 \u0437\u0430\u0440\u0435\u0436\u0434\u0430\u043d\u0435 \u043d\u0430 \u043a\u043b\u0430\u0441\u043e\u0432\u0435 \u0438 Jenkins \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430\ - \u0437\u0430\u0440\u0435\u0434\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u0430\u0442\u0430 \u0441\u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 JNA. \u0417\u0430 \u043f\u043e\u0432\u0435\u0447\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \ - \u043f\u0440\u0435\u0433\u043b\u0435\u0434\u0430\u0439\u0442\u0435 \u0443\u0438\u043a\u0438\u0442\u043e. diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_da.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_da.properties deleted file mode 100644 index 233d05d629e2..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_da.properties +++ /dev/null @@ -1,24 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -blurb=En anden instans af JNA er allerede indl\u00e6st i en anden classloader, dermed er det umuligt for Jenkins -Failed\ to\ load\ JNA=Kunne ikke indl\u00e6se JNA diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_de.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_de.properties deleted file mode 100644 index dad912086b36..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_de.properties +++ /dev/null @@ -1,28 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Simon Wiest -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Failed\ to\ load\ JNA=Java Native Access (JNA) konnte nicht geladen werden -blurb=\ - Eine JNA-Instanz wurde bereits von einem anderen Classloader geladen. \ - Dies hindert Jenkins daran, seine eigene JNA-Instanz zu laden. \ - Mehr... - diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_es.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_es.properties deleted file mode 100644 index 7e5e04393844..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_es.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -blurb=Otra instancia de JNA está en ejecución, echa un vistazo a esta \ - pagina para ver mas detalles. -Failed\ to\ load\ JNA=Fallo al cargar JNA diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_it.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_it.properties deleted file mode 100644 index 2e92e6aa4140..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_it.properties +++ /dev/null @@ -1,29 +0,0 @@ -# The MIT License -# -# Italian localization plugin for Jenkins -# Copyright © 2020 Alessandro Menti -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -blurb=Un''altra istanza di JNA è già caricata in un altro classloader, il che \ - fa sì che il caricamento della propria copia da parte di Jenkins sia \ - impossibile. \ - Si \ - veda il wiki per ulteriori dettagli. -Failed\ to\ load\ JNA=Caricamento di JNA non riuscito diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_ja.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_ja.properties deleted file mode 100644 index 44f4550f137c..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_ja.properties +++ /dev/null @@ -1,25 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Failed\ to\ load\ JNA=Java Native Access (JNA) \u306E\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002 -blurb=\u5225\u306E\u30AF\u30E9\u30B9\u30ED\u30FC\u30C0\u30FC\u304CJNA\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u65E2\u306B\u30ED\u30FC\u30C9\u3057\u3066\u3044\u307E\u3059\u3002\u305D\u306E\u305F\u3081\u3001Jenkins\u304C\u30ED\u30FC\u30C9\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3002\ - \u8A73\u7D30\u306F\u3001Wiki\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002 diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_pt_BR.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_pt_BR.properties deleted file mode 100644 index b4f458003f78..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_pt_BR.properties +++ /dev/null @@ -1,27 +0,0 @@ -# The MIT License -# -# Copyright (c) 2004-2010, Sun Microsystems, Inc., Cleiber Silva, Fernando Boaglio -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Failed\ to\ load\ JNA= -# Another instance of JNA is already loaded in another classloader, thereby making it impossible for Jenkins \ -# to load its own copy. See Wiki for more details. -blurb=Outra inst\u00e2ncia do JNA j\u00e1 est\u00e1 carregada em outro Classloader, impossibilitando ao Jenkins \ - diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_sr.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_sr.properties deleted file mode 100644 index 968ab9b0aebd..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_sr.properties +++ /dev/null @@ -1,4 +0,0 @@ -# This file is under the MIT License by authors - -Failed\ to\ load\ JNA=\u041D\u0438\u0458\u0435 \u043C\u043E\u0433\u043B\u043E \u0443\u0447\u0438\u0442\u0430\u0442\u0438 JNA -blurb=\u0414\u0440\u0443\u0433\u0430 \u0438\u043D\u0441\u0442\u0430\u043D\u0446\u0430 JNA \u0458\u0435 \u0432\u0435\u045B \u0443\u0447\u0438\u0442\u0430\u043D\u0430 \u0443 classloader, \u043F\u043E\u0442\u043E\u043C Jenkins \u043D\u0435\u043C\u043E\u0436\u0435 \u0443\u0447\u0438\u0442\u0430\u0442\u0438 \u0441\u0432\u043E\u0458\u0443 \u043A\u043E\u043F\u0438\u0458\u0443. \u041F\u0440\u0435\u0433\u043B\u0435\u0434\u0430\u0458\u0442\u0435 \u0412\u0438\u043A\u0438 \u0437\u0430 \u0432\u0438\u0448\u0435 \u0434\u0435\u0442\u0430\u0459\u0430. diff --git a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_zh_TW.properties b/core/src/main/resources/hudson/util/JNADoublyLoaded/index_zh_TW.properties deleted file mode 100644 index c44a72026e74..000000000000 --- a/core/src/main/resources/hudson/util/JNADoublyLoaded/index_zh_TW.properties +++ /dev/null @@ -1,26 +0,0 @@ -# The MIT License -# -# Copyright (c) 2013, Chunghwa Telecom Co., Ltd., Pei-Tang Huang -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -Failed\ to\ load\ JNA=JNA \u8f09\u5165\u5931\u6557 -blurb=\ - \u5df2\u7d93\u6709\u5176\u4ed6 ClassLoader \u8f09\u5165\u4e86 JNA\uff0cJenkins \u56e0\u6b64\u7121\u6cd5\u8f09\u5165\u81ea\u5df1\u7684\u7248\u672c\u3002\ - \u8acb\u53c3\u8003 Wiki \u4e0a\u7684\u8a73\u7d30\u8cc7\u6599\u3002 From 14d16a1679f95cf342b935535acadb6aa60d2c52 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 30 Nov 2021 15:04:12 -0800 Subject: [PATCH 18/24] Move Ant tests from core (#5988) --- .../tasks/EnvVarsInConfigTasksTest.java | 51 ------------------- .../tools/ToolLocationNodePropertyTest.java | 28 ---------- 2 files changed, 79 deletions(-) diff --git a/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java b/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java index 93bb9bc6f2df..c489f6091649 100644 --- a/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java +++ b/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java @@ -1,7 +1,5 @@ package hudson.tasks; -import static hudson.tasks._ant.Messages.Ant_ExecutableNotFound; -import static org.junit.Assert.assertFalse; import hudson.EnvVars; import hudson.model.FreeStyleBuild; @@ -10,10 +8,8 @@ import hudson.model.Result; import hudson.model.labels.LabelAtom; import hudson.slaves.DumbSlave; -import hudson.tasks.Ant.AntInstallation; import hudson.tasks.Maven.MavenInstallation; import org.apache.tools.ant.taskdefs.condition.Os; -import org.junit.Assume; import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; @@ -52,12 +48,6 @@ public void setUp() throws Exception { withVariable(defaultMaven.getHome()), JenkinsRule.NO_PROPERTIES); j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(varMaven); - // Ant with a variable in its path - AntInstallation ant = ToolInstallations.configureDefaultAnt(tmp); - AntInstallation antInstallation = new AntInstallation("varAnt", - withVariable(ant.getHome()),JenkinsRule.NO_PROPERTIES); - j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); - // create agents EnvVars additionalEnv = new EnvVars(DUMMY_LOCATION_VARNAME, ""); agentEnv = j.createSlave(new LabelAtom("agentEnv"), additionalEnv); @@ -100,47 +90,6 @@ public void testFreeStyleShellOnAgent() throws Exception { j.assertLogNotContains(DUMMY_LOCATION_VARNAME, build); } - @Test - public void testFreeStyleAntOnAgent() throws Exception { - Assume.assumeFalse( - "Cannot do testFreeStyleAntOnAgent without ANT_HOME", - j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations().length == 0 - ); - - FreeStyleProject project = j.createFreeStyleProject(); - project.setJDK(j.jenkins.getJDK("varJDK")); - project.setScm(new ExtractResourceSCM(getClass().getResource( - "/simple-projects.zip"))); - - String buildFile = "build.xml${" + DUMMY_LOCATION_VARNAME + "}"; - // we need additional escapes because bash itself expanding - project.getBuildersList().add( - new Ant("-Dtest.property=cor${" + DUMMY_LOCATION_VARNAME - + "}rect", "varAnt", "", buildFile, "")); - - // test the regular agent - variable not expanded - project.setAssignedLabel(agentRegular.getSelfLabel()); - FreeStyleBuild build = project.scheduleBuild2(0).get(); - - j.assertBuildStatus(Result.FAILURE, build); - - j.assertLogContains(Ant_ExecutableNotFound("varAnt"), build); - - // test the agent with prepared environment - project.setAssignedLabel(agentEnv.getSelfLabel()); - build = project.scheduleBuild2(0).get(); - - j.assertBuildStatusSuccess(build); - - // Check variable was expanded - j.assertLogContains("Ant home: ", build); - j.assertLogContains("Test property: correct", build); - assertFalse(JenkinsRule.getLog(build).matches("(?s)^.*Ant home: [^\\n\\r]*" - + DUMMY_LOCATION_VARNAME + ".*$")); - assertFalse(JenkinsRule.getLog(build).matches("(?s)^.*Test property: [^\\n\\r]*" - + DUMMY_LOCATION_VARNAME + ".*$")); - } - @Test public void testFreeStyleMavenOnAgent() throws Exception { FreeStyleProject project = j.createFreeStyleProject(); diff --git a/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java b/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java index 0d85fd44bccc..358c00bff648 100644 --- a/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java +++ b/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java @@ -29,26 +29,20 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; import hudson.EnvVars; import hudson.Functions; -import hudson.model.Build; import hudson.model.FreeStyleProject; import hudson.model.JDK; -import hudson.model.Result; import hudson.model.labels.LabelAtom; import hudson.slaves.DumbSlave; -import hudson.tasks.Ant; import hudson.tasks.Ant.AntInstallation; import hudson.tasks.BatchFile; import hudson.tasks.Maven.MavenInstallation; import hudson.tasks.Shell; -import jenkins.model.Jenkins; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.jvnet.hudson.test.JenkinsRule; import org.jvnet.hudson.test.JenkinsRule.WebClient; -import org.jvnet.hudson.test.SingleFileSCM; -import org.jvnet.hudson.test.ToolInstallations; /** * This class tests that environment variables from node properties are applied, @@ -113,28 +107,6 @@ private void configureDumpEnvBuilder() { project.getBuildersList().add(new Shell("export")); } - @Test - public void ant() throws Exception { - Ant.AntInstallation ant = ToolInstallations.configureDefaultAnt(tmp); - String antPath = ant.getHome(); - Jenkins.get().getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(new AntInstallation("ant", "THIS IS WRONG")); - - project.setScm(new SingleFileSCM("build.xml", "")); - project.getBuildersList().add(new Ant("-version", "ant", null,null,null)); - configureDumpEnvBuilder(); - - Build build = project.scheduleBuild2(0).get(); - j.assertBuildStatus(Result.FAILURE, build); - - ToolLocationNodeProperty property = new ToolLocationNodeProperty( - new ToolLocationNodeProperty.ToolLocation(j.jenkins.getDescriptorByType(AntInstallation.DescriptorImpl.class), "ant", antPath)); - slave.getNodeProperties().add(property); - - build = project.scheduleBuild2(0).get(); - System.out.println(build.getLog()); - j.assertBuildStatus(Result.SUCCESS, build); - } - @Before public void setUp() throws Exception { EnvVars env = new EnvVars(); From 8eed9454341763f26106d8577895a24ee5c0c8aa Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 1 Dec 2021 00:51:11 -0800 Subject: [PATCH 19/24] Enable `RequireThis` Checkstyle check (#5991) --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index f7eea3cbe66e..0f4a82adc5ea 100644 --- a/pom.xml +++ b/pom.xml @@ -458,6 +458,7 @@ THE SOFTWARE. + From 06fc504733814add0ea3d65298ee4cd061796b7e Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 1 Dec 2021 05:59:11 -0800 Subject: [PATCH 20/24] Enable `SuperFinalize` Checkstyle check (#5977) --- core/src/main/java/hudson/util/AtomicFileWriter.java | 6 +++++- pom.xml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/util/AtomicFileWriter.java b/core/src/main/java/hudson/util/AtomicFileWriter.java index 9ae7f7968f9d..508cae60bf4a 100644 --- a/core/src/main/java/hudson/util/AtomicFileWriter.java +++ b/core/src/main/java/hudson/util/AtomicFileWriter.java @@ -226,7 +226,11 @@ public void commit() throws IOException { @Override protected void finalize() throws Throwable { - closeAndDeleteTempFile(); + try { + closeAndDeleteTempFile(); + } finally { + super.finalize(); + } } private void closeAndDeleteTempFile() throws IOException { diff --git a/pom.xml b/pom.xml index 0f4a82adc5ea..894a0daca8eb 100644 --- a/pom.xml +++ b/pom.xml @@ -462,6 +462,7 @@ THE SOFTWARE. + From 5e41440ddc0e66c9cb54da1de3aecd42a50c4482 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 1 Dec 2021 08:49:49 -0800 Subject: [PATCH 21/24] Clean up `ClassLoaderReflectionToolkit` (#5927) --- .../jenkins/ClassLoaderReflectionToolkit.java | 143 ++++++------------ 1 file changed, 50 insertions(+), 93 deletions(-) diff --git a/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java b/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java index 24a48a0e2250..5e18c6a5ffa1 100644 --- a/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java +++ b/core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java @@ -2,6 +2,7 @@ import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; +import hudson.RestrictedSince; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -9,6 +10,8 @@ import java.net.URLClassLoader; import java.util.Enumeration; import jenkins.util.JenkinsClassLoader; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.NoExternalUse; /** * Reflective access to various {@link ClassLoader} methods which are otherwise {@code protected}. @@ -23,7 +26,8 @@ * the {@code JenkinsRule} tests use a different classloader, * but once that is made consistent with production Jenkins we can re-evaluate the fallback code. */ -@SuppressWarnings({"unchecked", "rawtypes"}) +@Restricted(NoExternalUse.class) +@RestrictedSince("TODO") public class ClassLoaderReflectionToolkit { private static Object invoke(Method method, Class exception, Object obj, Object... args) throws T { @@ -45,6 +49,20 @@ private static Object invoke(Method method, Class excep } } + /** + * Return the lock object for class loading operations. + * + *

If the {@link ClassLoader} object is registered as parallel capable, the method returns a + * dedicated object associated with the specified class name. Otherwise, the method returns the + * {@link ClassLoader} object. + * + * @param name The name of the to-be-loaded class. + * @return The lock for class loading operations. + * @throws NullPointerException If registered as parallel capable and {@code name} is {@code + * null}. + * @see ClassLoader#getClassLoadingLock(String) + * @since 1.553 + */ private static Object getClassLoadingLock(ClassLoader cl, String name) { if (cl instanceof JenkinsClassLoader) { return ((JenkinsClassLoader) cl).getClassLoadingLock(name); @@ -67,25 +85,6 @@ private static class GetClassLoadingLock { } } - /** - * Calls {@link ClassLoader#findLoadedClass} while holding {@link ClassLoader#getClassLoadingLock}. - * @since 1.553 - * @deprecated use {@link #loadClass(ClassLoader, String)} - */ - @Deprecated - public static @CheckForNull Class _findLoadedClass(ClassLoader cl, String name) { - synchronized (getClassLoadingLock(cl, name)) { - Class c; - if (cl instanceof JenkinsClassLoader) { - c = ((JenkinsClassLoader) cl).findLoadedClass2(name); - } else { - c = (Class) invoke(FindLoadedClass.FIND_LOADED_CLASS, RuntimeException.class, cl, name); - } - - return c; - } - } - private static class FindLoadedClass { private static final Method FIND_LOADED_CLASS; @@ -99,22 +98,6 @@ private static class FindLoadedClass { } } - /** - * Calls {@link ClassLoader#findClass} while holding {@link ClassLoader#getClassLoadingLock}. - * @since 1.553 - * @deprecated use {@link #loadClass(ClassLoader, String)} - */ - @Deprecated - public static @NonNull Class _findClass(ClassLoader cl, String name) throws ClassNotFoundException { - synchronized (getClassLoadingLock(cl, name)) { - if (cl instanceof JenkinsClassLoader) { - return ((JenkinsClassLoader) cl).findClass(name); - } else { - return (Class) invoke(FindClass.FIND_CLASS, ClassNotFoundException.class, cl, name); - } - } - } - private static class FindClass { private static final Method FIND_CLASS; @@ -137,7 +120,7 @@ private static class FindClass { *

Invoke {@link ClassLoader#findLoadedClass(String)} to check if the class has already * been loaded. *

  • - *

    Invoke the {@link ClassLoader#findClass(String)} method to find the class. + *

    Invoke {@link ClassLoader#findClass(String)} to find the class. * * *

    This method synchronizes on the result of {@link ClassLoader#getClassLoadingLock(String)} @@ -147,6 +130,7 @@ private static class FindClass { * @param name The binary name of the class. * @return The resulting {@link Class} object. * @throws ClassNotFoundException If the class could not be found. + * @see ClassLoader#loadClass(String) * @since 2.321 */ public static @NonNull Class loadClass(ClassLoader cl, String name) throws ClassNotFoundException { @@ -156,23 +140,29 @@ private static class FindClass { if (cl instanceof JenkinsClassLoader) { c = ((JenkinsClassLoader) cl).findLoadedClass2(name); } else { - c = (Class) invoke(FindLoadedClass.FIND_LOADED_CLASS, RuntimeException.class, cl, name); + c = (Class) invoke(FindLoadedClass.FIND_LOADED_CLASS, RuntimeException.class, cl, name); } - if (c != null) { - return c; - } - - // Find the class. - if (cl instanceof JenkinsClassLoader) { - return ((JenkinsClassLoader) cl).findClass(name); - } else { - return (Class) invoke(FindClass.FIND_CLASS, ClassNotFoundException.class, cl, name); + if (c == null) { + // Find the class. + if (cl instanceof JenkinsClassLoader) { + c = ((JenkinsClassLoader) cl).findClass(name); + } else { + c = (Class) invoke(FindClass.FIND_CLASS, ClassNotFoundException.class, cl, name); + } } + return c; } } /** - * Calls {@link ClassLoader#findResource}. + * Find the resource with the given name. + * + * @param name The resource name. + * @return {@link URL} object for reading the resource; {@code null} if the resource could not + * be found, a {@link URL} could not be constructed to locate the resource, the resource is + * in a package that is not opened unconditionally, or access to the resource is denied by + * the security manager. + * @see ClassLoader#findResource(String) * @since 1.553 */ public static @CheckForNull URL _findResource(ClassLoader cl, String name) { @@ -202,9 +192,20 @@ private static class FindResource { } /** - * Calls {@link ClassLoader#findResources}. + * Return an enumeration of {@link URL} objects representing all the resources with the given + * name. + * + * @param name The resource name. + * @return An enumeration of {@link URL} objects for the resource. If no resources could be + * found, the enumeration will be empty. Resources for which a {@link URL} cannot be + * constructed, which are in a package that is not opened unconditionally, or for which + * access to the resource is denied by the security manager, are not returned in the + * enumeration. + * @throws IOException If I/O errors occur. + * @see ClassLoader#findResources(String) * @since 1.553 */ + @SuppressWarnings("unchecked") public static @NonNull Enumeration _findResources(ClassLoader cl, String name) throws IOException { Enumeration urls; if (cl instanceof JenkinsClassLoader) { @@ -228,48 +229,4 @@ private static class FindResources { FIND_RESOURCES.setAccessible(true); } } - - /** @deprecated unsafe */ - @Deprecated public ClassLoaderReflectionToolkit() {} - - /** @deprecated unsafe */ - @Deprecated - public Class findLoadedClass(ClassLoader cl, String name) throws InvocationTargetException { - try { - return (Class)FindLoadedClass.FIND_LOADED_CLASS.invoke(cl,name); - } catch (IllegalAccessException e) { - throw new LinkageError(e.getMessage(), e); - } - } - - /** @deprecated unsafe */ - @Deprecated - public Class findClass(ClassLoader cl, String name) throws InvocationTargetException { - try { - return (Class)FindClass.FIND_CLASS.invoke(cl,name); - } catch (IllegalAccessException e) { - throw new LinkageError(e.getMessage(), e); - } - } - - /** @deprecated unsafe */ - @Deprecated - public URL findResource(ClassLoader cl, String name) throws InvocationTargetException { - try { - return (URL)FindResource.FIND_RESOURCE.invoke(cl,name); - } catch (IllegalAccessException e) { - throw new LinkageError(e.getMessage(), e); - } - } - - /** @deprecated unsafe */ - @Deprecated - public Enumeration findResources(ClassLoader cl, String name) throws InvocationTargetException { - try { - return (Enumeration)FindResources.FIND_RESOURCES.invoke(cl,name); - } catch (IllegalAccessException e) { - throw new LinkageError(e.getMessage(), e); - } - } - } From 9fd69f7e34c5ffb16e391e45fce5c36a8e35766a Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 1 Dec 2021 08:50:03 -0800 Subject: [PATCH 22/24] Remove `libpam4j` (#5980) --- bom/pom.xml | 5 ----- core/pom.xml | 4 ---- core/src/main/java/hudson/util/jna/GNUCLibrary.java | 3 --- 3 files changed, 12 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index d57d6aced5e3..cbf02bc59b11 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -263,11 +263,6 @@ THE SOFTWARE. jna 5.10.0 - - org.kohsuke - libpam4j - 1.11 - com.sun.solaris embedded_su4j diff --git a/core/pom.xml b/core/pom.xml index 7af7df22c56d..494997f2fa8f 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -453,10 +453,6 @@ THE SOFTWARE. net.java.dev.jna jna - - org.kohsuke - libpam4j - com.sun.solaris embedded_su4j diff --git a/core/src/main/java/hudson/util/jna/GNUCLibrary.java b/core/src/main/java/hudson/util/jna/GNUCLibrary.java index ef0bc7a13906..263a3e7100f2 100644 --- a/core/src/main/java/hudson/util/jna/GNUCLibrary.java +++ b/core/src/main/java/hudson/util/jna/GNUCLibrary.java @@ -34,7 +34,6 @@ import com.sun.jna.ptr.NativeLongByReference; import hudson.os.PosixAPI; import jnr.posix.POSIX; -import org.jvnet.libpam.impl.CLibrary.passwd; /** * GNU C library. @@ -64,8 +63,6 @@ public interface GNUCLibrary extends Library { void perror(String msg); String strerror(int errno); - passwd getpwuid(int uid); - int fcntl(int fd, int command); int fcntl(int fd, int command, int flags); From 8ee11e2e30f26d022bcd0ff5f5292f5032898f74 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 1 Dec 2021 08:50:11 -0800 Subject: [PATCH 23/24] Migrate from Apache Commons `StringUtils#join` to Java Platform `String#join` (#5992) --- core/src/main/java/hudson/FilePath.java | 2 +- core/src/main/java/hudson/TcpSlaveAgentListener.java | 3 +-- core/src/main/java/hudson/logging/LogRecorder.java | 3 +-- .../main/java/hudson/model/ChoiceParameterDefinition.java | 2 +- core/src/main/java/hudson/model/Items.java | 4 ++-- core/src/main/java/hudson/model/View.java | 2 +- .../java/jenkins/model/queue/CompositeCauseOfBlockage.java | 3 +-- .../jenkins/tasks/filters/impl/RetainVariablesLocalRule.java | 4 ++-- test/src/test/java/jenkins/AgentProtocolTest.java | 5 ++--- 9 files changed, 12 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 216b361c89a1..ef4867ea0a9b 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1639,7 +1639,7 @@ public FilePath createTempDir(final String prefix, final String suffix) throws I } else { s = new String[]{prefix, suffix}; } - String name = StringUtils.join(s, "."); + String name = String.join(".", s); return new FilePath(this, act(new CreateTempDir(name))); } catch (IOException e) { throw new IOException("Failed to create a temp directory on "+remote,e); diff --git a/core/src/main/java/hudson/TcpSlaveAgentListener.java b/core/src/main/java/hudson/TcpSlaveAgentListener.java index 32a8741b9ad9..e7875e95bdb0 100644 --- a/core/src/main/java/hudson/TcpSlaveAgentListener.java +++ b/core/src/main/java/hudson/TcpSlaveAgentListener.java @@ -57,7 +57,6 @@ import jenkins.util.SystemProperties; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.NullOutputStream; -import org.apache.commons.lang.StringUtils; import org.jenkinsci.Symbol; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; @@ -159,7 +158,7 @@ public String getIdentityPublicKey() { * @since 2.16 */ public String getAgentProtocolNames() { - return StringUtils.join(Jenkins.get().getAgentProtocols(), ", "); + return String.join(", ", Jenkins.get().getAgentProtocols()); } /** diff --git a/core/src/main/java/hudson/logging/LogRecorder.java b/core/src/main/java/hudson/logging/LogRecorder.java index ab82ffdd5550..09c7a69cd35b 100644 --- a/core/src/main/java/hudson/logging/LogRecorder.java +++ b/core/src/main/java/hudson/logging/LogRecorder.java @@ -72,7 +72,6 @@ import javax.servlet.ServletException; import jenkins.security.MasterToSlaveCallable; import net.sf.json.JSONObject; -import org.apache.commons.lang.StringUtils; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.stapler.DataBoundConstructor; @@ -169,7 +168,7 @@ public static Set getAutoCompletionCandidates(List loggerNamesLi String longerPrefix = null; for (int i = loggerNameParts.length; i > 0; i--) { - String loggerNamePrefix = StringUtils.join(Arrays.copyOf(loggerNameParts, i), "."); + String loggerNamePrefix = String.join(".", Arrays.copyOf(loggerNameParts, i)); seenPrefixes.put(loggerNamePrefix, seenPrefixes.getOrDefault(loggerNamePrefix, 0) + 1); if (longerPrefix == null) { relevantPrefixes.add(loggerNamePrefix); // actual logger name diff --git a/core/src/main/java/hudson/model/ChoiceParameterDefinition.java b/core/src/main/java/hudson/model/ChoiceParameterDefinition.java index 7d04e5c4b5ad..286d12505a76 100644 --- a/core/src/main/java/hudson/model/ChoiceParameterDefinition.java +++ b/core/src/main/java/hudson/model/ChoiceParameterDefinition.java @@ -130,7 +130,7 @@ public List getChoices() { } public String getChoicesText() { - return StringUtils.join(choices, "\n"); + return String.join("\n", choices); } @Override diff --git a/core/src/main/java/hudson/model/Items.java b/core/src/main/java/hudson/model/Items.java index 7811e6822551..ddb33a4e8505 100644 --- a/core/src/main/java/hudson/model/Items.java +++ b/core/src/main/java/hudson/model/Items.java @@ -278,7 +278,7 @@ public static String getCanonicalName(ItemGroup context, String path) { } name.push(p[i]); } - return StringUtils.join(name, '/'); + return String.join("/", name); } /** @@ -312,7 +312,7 @@ public static String computeRelativeNamesAfterRenaming(String oldFullName, Strin newValue.add(relativeName); } } - return StringUtils.join(newValue, ","); + return String.join(",", newValue); } // Had difficulty adapting the version in Functions to use no live items, so rewrote it: diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 7347db0834d6..384034a8a904 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -1131,7 +1131,7 @@ public Categories doItemCategories(StaplerRequest req, StaplerResponse rsp, @Que metadata.put("iconClassName", iconClassName); if (ctx != null) { Icon icon = IconSet.icons - .getIconByClassSpec(StringUtils.join(new String[]{iconClassName, iconStyle}, " ")); + .getIconByClassSpec(String.join(" ", iconClassName, iconStyle)); if (icon != null) { metadata.put("iconQualifiedUrl", icon.getQualifiedUrl(ctx)); } diff --git a/core/src/main/java/jenkins/model/queue/CompositeCauseOfBlockage.java b/core/src/main/java/jenkins/model/queue/CompositeCauseOfBlockage.java index 9cb04c3bb7d6..b389d385bb60 100644 --- a/core/src/main/java/jenkins/model/queue/CompositeCauseOfBlockage.java +++ b/core/src/main/java/jenkins/model/queue/CompositeCauseOfBlockage.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.apache.commons.lang.StringUtils; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; @@ -50,7 +49,7 @@ public CompositeCauseOfBlockage(List delegates) { @Override public String getShortDescription() { - return StringUtils.join(uniqueReasons.keySet(), "; "); + return String.join("; ", uniqueReasons.keySet()); } @Override diff --git a/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java b/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java index ee867332cfbf..4419a6e3849c 100644 --- a/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java +++ b/core/src/main/java/jenkins/tasks/filters/impl/RetainVariablesLocalRule.java @@ -163,12 +163,12 @@ public void filter(@NonNull EnvVars envVars, @NonNull EnvVarsFilterRuleContext c } if (!variablesRemoved.isEmpty()) { - context.getTaskListener().getLogger().println(Messages.RetainVariablesLocalRule_RemovalMessage(getDescriptor().getDisplayName(), StringUtils.join(variablesRemoved.toArray(), ", "))); + context.getTaskListener().getLogger().println(Messages.RetainVariablesLocalRule_RemovalMessage(getDescriptor().getDisplayName(), String.join(", ", variablesRemoved))); } if (!variablesReset.isEmpty()) { // reset the variables using the initial value from System variablesReset.forEach(variableName -> envVars.put(variableName, systemEnvVars.get(variableName))); - context.getTaskListener().getLogger().println(Messages.RetainVariablesLocalRule_ResetMessage(getDescriptor().getDisplayName(), StringUtils.join(variablesReset.toArray(), ", "))); + context.getTaskListener().getLogger().println(Messages.RetainVariablesLocalRule_ResetMessage(getDescriptor().getDisplayName(), String.join(", ", variablesReset))); } } diff --git a/test/src/test/java/jenkins/AgentProtocolTest.java b/test/src/test/java/jenkins/AgentProtocolTest.java index 55925be2d558..ccfdbb9ad27b 100644 --- a/test/src/test/java/jenkins/AgentProtocolTest.java +++ b/test/src/test/java/jenkins/AgentProtocolTest.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.Set; import jenkins.model.Jenkins; -import org.apache.commons.lang.StringUtils; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.Issue; @@ -84,9 +83,9 @@ public static void assertProtocols(Jenkins jenkins, boolean shouldBeEnabled, @Ch if (!failedChecks.isEmpty()) { String message = String.format("Protocol(s) are not %s: %s. %sEnabled protocols: %s", shouldBeEnabled ? "enabled" : "disabled", - StringUtils.join(failedChecks, ','), + String.join(",", failedChecks), why != null ? "Reason: " + why + ". " : "", - StringUtils.join(agentProtocols, ',')); + String.join(",", agentProtocols)); fail(message); } } From da7935d6cca1e48adbdea9ecae8c9a150e8ce5e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 17:00:05 +0000 Subject: [PATCH 24/24] Bump ant from 1.12 to 1.13 (#5995) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pom.xml b/test/pom.xml index 9a28e82d1dd1..4e9add7365cb 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -54,7 +54,7 @@ THE SOFTWARE. org.jenkins-ci.plugins ant - 1.12 + 1.13