diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
index 43d62816190d..a65d82e1b647 100644
--- a/.mvn/extensions.xml
+++ b/.mvn/extensions.xml
@@ -2,6 +2,6 @@
io.jenkins.tools.incrementalsgit-changelist-maven-extension
- 1.2
+ 1.3
diff --git a/bom/pom.xml b/bom/pom.xml
index e6f01226dfad..2fe8f8bfd9b3 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -37,7 +37,6 @@ THE SOFTWARE.
Jenkins BOMThe module contains dependencies that are used by a specific Jenkins version
-
9.21.7.32
@@ -47,7 +46,8 @@ THE SOFTWARE.
-
+
+
org.springframework.securityspring-security-bom5.6.1
@@ -119,10 +119,11 @@ THE SOFTWARE.
${slf4jVersion}
+
commons-loggingcommons-logging1.2
- provided
+ providedorg.slf4j
@@ -130,10 +131,11 @@ THE SOFTWARE.
${slf4jVersion}
+
log4jlog4j1.2.17
- provided
+ providedorg.samba.jcifs
@@ -226,7 +228,8 @@ THE SOFTWARE.
windows-package-checker1.2
-
+
+
args4jargs4j2.33
@@ -340,7 +343,8 @@ THE SOFTWARE.
groovy-all${groovy.version}
-
+
+
org.fusesource.jansijansi1.11
@@ -372,7 +376,7 @@ THE SOFTWARE.
jenkins-stapler-support1.1
-
+ org.kohsuke.staplerjson-lib2.4-jenkins-3
@@ -464,10 +468,10 @@ THE SOFTWARE.
flatten
- process-resourcesflatten
+ process-resourcesbom
diff --git a/cli/pom.xml b/cli/pom.xml
index 59a7354a8527..34a47850a8b2 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -130,10 +130,10 @@
3.2.4
- packageshade
+ packagefalse
@@ -187,10 +187,10 @@
add-source
- generate-sourcesadd-source
+ generate-sources
diff --git a/cli/src/main/java/hudson/cli/CLI.java b/cli/src/main/java/hudson/cli/CLI.java
index 06baf6be13e6..862847df9673 100644
--- a/cli/src/main/java/hudson/cli/CLI.java
+++ b/cli/src/main/java/hudson/cli/CLI.java
@@ -115,7 +115,7 @@ public static int _main(String[] _args) throws Exception {
if (url==null)
url = System.getenv("HUDSON_URL");
-
+
boolean noKeyAuth = false;
// TODO perhaps allow mode to be defined by environment variable too (assuming $JENKINS_USER_ID can be used for -user)
@@ -189,9 +189,9 @@ public boolean verify(String s, SSLSession sslSession) {
continue;
}
if (head.equals("-noKeyAuth")) {
- noKeyAuth = true;
- args = args.subList(1,args.size());
- continue;
+ noKeyAuth = true;
+ args = args.subList(1,args.size());
+ continue;
}
if(head.equals("-i") && args.size()>=2) {
File f = getFileFromArguments(args);
diff --git a/cli/src/test/java/hudson/cli/PrivateKeyProviderTest.java b/cli/src/test/java/hudson/cli/PrivateKeyProviderTest.java
index 9205c853f8ce..8d960e87a461 100644
--- a/cli/src/test/java/hudson/cli/PrivateKeyProviderTest.java
+++ b/cli/src/test/java/hudson/cli/PrivateKeyProviderTest.java
@@ -50,7 +50,7 @@ public void loadKeyDSAPassword() throws IOException, GeneralSecurityException {
String password = "password";
assertKeyPairNotNull(file, password);
}
-
+
/**
key command: ssh-keygen -f rsa -t rsa -b 1024 -m PEM
*/
@@ -69,7 +69,7 @@ public void loadKeyRSAPassword() throws IOException, GeneralSecurityException {
String password = "password";
assertKeyPairNotNull(file, password);
}
-
+
/**
key command: ssh-keygen -f openssh -t rsa -b 1024
*/
@@ -78,7 +78,7 @@ public void loadKeyOpenSSH() throws IOException, GeneralSecurityException {
File file = new File(this.getClass().getResource("openssh").getFile());
assertKeyPairNotNull(file, null);
}
-
+
/**
key command: ssh-keygen -f openssh-unsupported -t rsa -b 1024 -m PKCS8 -p password
*/
@@ -123,7 +123,7 @@ public void loadBlankKey() throws IOException, GeneralSecurityException {
/**
key command: ssh-keygen -f openssh -t rsa -b 1024
in this key we remove some lines to break the key.
- */
+ */
@Test
public void loadKeyBroken() throws IOException, GeneralSecurityException {
File file = new File(this.getClass().getResource("openssh-broken").getFile());
diff --git a/core/pom.xml b/core/pom.xml
index 48d4ea485f9b..0b10a40a0d22 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -56,7 +56,6 @@ THE SOFTWARE.
-
${project.groupId}
@@ -76,7 +75,8 @@ THE SOFTWARE.
crypto-util
-
+
+
org.jenkins-cicore-annotation-processors1.0
@@ -163,7 +163,8 @@ THE SOFTWARE.
org.kohsuke.staplerstapler-adjunct-codemirror
-
+
+
org.kohsuke.staplerstapler-adjunct-timeline1.5
@@ -193,7 +194,7 @@ THE SOFTWARE.
${bridge-method-injector.version}
-
+ org.kohsuke.staplerjson-lib
@@ -266,7 +267,8 @@ THE SOFTWARE.
commons-iocommons-io
-
+
+
commons-langcommons-lang
@@ -382,13 +384,15 @@ THE SOFTWARE.
org.codehaus.groovygroovy-all
-
+
+
jlinejline2.14.6compile
-
+
+
org.fusesource.jansijansi
@@ -427,7 +431,8 @@ THE SOFTWARE.
${mockito.version}test
-
+
+
jakarta.servlet.jsp.jstljakarta.servlet.jsp.jstl-api
@@ -483,7 +488,8 @@ THE SOFTWARE.
org.kohsuke.jinteropj-interop
-
+
+
org.kohsuke.metainf-servicesmetainf-services1.8
@@ -583,10 +589,10 @@ THE SOFTWARE.
add-source
- generate-sourcesadd-source
+ generate-sources
@@ -639,7 +645,8 @@ THE SOFTWARE.
maven-stapler-plugin
- ${staplerFork}
+
+ ${staplerFork}128m
@@ -704,11 +711,11 @@ THE SOFTWARE.
winsw
- generate-resourcescopy
+ generate-resources
@@ -733,7 +740,8 @@ THE SOFTWARE.
false
-
+
+
maven-jar-plugin
@@ -751,7 +759,8 @@ THE SOFTWARE.
-
+
+
org.kohsuke.staplermaven-stapler-plugin
@@ -761,7 +770,8 @@ THE SOFTWARE.
-
+
+
maven-project-info-reports-plugin
@@ -834,7 +844,8 @@ THE SOFTWARE.
com.github.siom79.japicmpjapicmp-maven-plugin
- 0.14.4-20200728.214757-1
+
+ 0.14.4-20200728.214757-1
@@ -843,7 +854,8 @@ THE SOFTWARE.
true
-
+
+
javax.servletjavax.servlet-api3.1.0
@@ -853,10 +865,10 @@ THE SOFTWARE.
- verifycmp
+ verify
diff --git a/core/src/main/java/hudson/ClassicPluginStrategy.java b/core/src/main/java/hudson/ClassicPluginStrategy.java
index ef29f481586b..46e2d7235fb5 100644
--- a/core/src/main/java/hudson/ClassicPluginStrategy.java
+++ b/core/src/main/java/hudson/ClassicPluginStrategy.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Tom Huybrechts
- *
+ *
* 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
@@ -121,7 +121,7 @@ private static boolean isLinked(File archive) {
}
private static Manifest loadLinkedManifest(File archive) throws IOException {
- // resolve the .hpl file to the location of the manifest file
+ // resolve the .hpl file to the location of the manifest file
try {
// Locate the manifest
String firstLine;
@@ -137,7 +137,7 @@ private static Manifest loadLinkedManifest(File archive) throws IOException {
// indirection
archive = resolve(archive, firstLine);
}
-
+
// Read the manifest
try (InputStream manifestInput = Files.newInputStream(archive.toPath())) {
return new Manifest(manifestInput);
@@ -232,7 +232,7 @@ private static Manifest loadLinkedManifest(File archive) throws IOException {
}
}
}
-
+
fix(atts,optionalDependencies);
// Register global classpath mask. This is useful for hiding JavaEE APIs that you might see from the container,
@@ -253,7 +253,7 @@ private static Manifest loadLinkedManifest(File archive) throws IOException {
private void fix(Attributes atts, List optionalDependencies) {
String pluginName = atts.getValue("Short-Name");
-
+
String jenkinsVersion = atts.getValue("Jenkins-Version");
if (jenkinsVersion==null)
jenkinsVersion = atts.getValue("Hudson-Version");
@@ -430,7 +430,7 @@ private DependencyClassLoader findAncestorDependencyClassLoader(ClassLoader clas
if (classLoader instanceof DependencyClassLoader) {
return (DependencyClassLoader)classLoader;
}
-
+
if (classLoader instanceof AntClassLoader) {
// AntClassLoaders hold parents not only as AntClassLoader#getParent()
// but also as AntClassLoader#getConfiguredParent()
diff --git a/core/src/main/java/hudson/CopyOnWrite.java b/core/src/main/java/hudson/CopyOnWrite.java
index ff6bc92d5756..a36dbaf4e9f9 100644
--- a/core/src/main/java/hudson/CopyOnWrite.java
+++ b/core/src/main/java/hudson/CopyOnWrite.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/ExtensionListListener.java b/core/src/main/java/hudson/ExtensionListListener.java
index f5c8528add39..6a29da2d465d 100644
--- a/core/src/main/java/hudson/ExtensionListListener.java
+++ b/core/src/main/java/hudson/ExtensionListListener.java
@@ -35,7 +35,7 @@ public abstract class ExtensionListListener {
* {@link ExtensionList} contents has changed.
*
* This would be called when an entry gets added to or removed from the list for any reason e.g.
- * when a dynamically loaded plugin introduces a new {@link ExtensionPoint} implementation
+ * when a dynamically loaded plugin introduces a new {@link ExtensionPoint} implementation
* that adds an entry to the {@link ExtensionList} being listened to.
*/
public abstract void onChange();
diff --git a/core/src/main/java/hudson/ExtensionPoint.java b/core/src/main/java/hudson/ExtensionPoint.java
index 73063ec8324d..426aa52b05a3 100644
--- a/core/src/main/java/hudson/ExtensionPoint.java
+++ b/core/src/main/java/hudson/ExtensionPoint.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -51,7 +51,7 @@ public interface ExtensionPoint {
/**
* Used by designers of extension points (direct subtypes of {@link ExtensionPoint}) to indicate that
* the legacy instances are scoped to {@link Jenkins} instance. By default, legacy instances are
- * static scope.
+ * static scope.
*/
@Target(TYPE)
@Retention(RUNTIME)
diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java
index cadb8cc257e9..a3eb22406c32 100644
--- a/core/src/main/java/hudson/FilePath.java
+++ b/core/src/main/java/hudson/FilePath.java
@@ -1,20 +1,20 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Eric Lefevre-Ardant, Erik Ramfelt, Michael B. Donohue, Alan Harder,
* Manufacture Francaise des Pneumatiques Michelin, Romain Seguy
- *
+ *
* 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
@@ -198,7 +198,7 @@
*
* When {@link FileCallable} is transferred to a remote node, it will be done so
* by using the same Java serialization scheme that the remoting module uses.
- * See {@link Channel} for more about this.
+ * See {@link Channel} for more about this.
*
*
* {@link FilePath} itself can be sent over to a remote node as a part of {@link Callable}
@@ -229,7 +229,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
* This is used to determine whether we are running on the controller / the built-in node, or an agent.
*/
private transient VirtualChannel channel;
-
+
/**
* Represent the path to the file in the controller or the agent
* Since the platform of the agent might be different, can't use java.io.File
@@ -369,7 +369,7 @@ boolean isUnix() {
// if the path represents a local path, there' no need to guess.
if(!isRemote())
return File.pathSeparatorChar!=';';
-
+
// note that we can't use the usual File.pathSeparator and etc., as the OS of
// the machine where this code runs and the OS that this FilePath refers to may be different.
@@ -411,7 +411,7 @@ public void zip(FilePath dst) throws IOException, InterruptedException {
zip(os);
}
}
-
+
/**
* Creates a zip file from this directory by using the specified filter,
* and sends the result to the given output stream.
@@ -808,7 +808,7 @@ public Void invoke(File f, VirtualChannel channel) throws IOException, Interrupt
return null;
}
}
-
+
/**
* Resolves symlink, if the given file is a symlink. Otherwise return null.
*
@@ -843,7 +843,7 @@ public boolean equals(Object o) {
public int hashCode() {
return 31 * (channel != null ? channel.hashCode() : 0) + remote.hashCode();
}
-
+
/**
* Supported tar file compression methods.
*/
@@ -1083,7 +1083,7 @@ public void copyFrom(InputStream in) throws IOException, InterruptedException {
/**
* Convenience method to call {@link FilePath#copyTo(FilePath)}.
- *
+ *
* @since 1.311
*/
public void copyFrom(FilePath src) throws IOException, InterruptedException {
@@ -1345,7 +1345,7 @@ public Boolean invoke(File f, VirtualChannel channel) throws IOException, Interr
return mkdirs(f) || f.exists();
}
}
-
+
/**
* Deletes all suffixes recursively.
* @throws IOException if it exists but could not be successfully deleted
@@ -1368,7 +1368,7 @@ public Void invoke(File f, VirtualChannel channel) throws IOException {
Util.deleteRecursive(file.toPath(), path -> path.toFile());
}
}
-
+
return null;
}
}
@@ -1734,7 +1734,7 @@ public Void invoke(File f, VirtualChannel channel) throws IOException {
return null;
}
}
-
+
private void setLastModifiedIfPossible(final long timestamp) throws IOException, InterruptedException {
String message = act(new SetLastModified(timestamp));
@@ -1776,7 +1776,7 @@ public Boolean invoke(File f, VirtualChannel channel) throws IOException {
return f.isDirectory();
}
}
-
+
/**
* Returns the file size in bytes.
*
@@ -2242,18 +2242,18 @@ public int read(byte[] b) throws IOException {
actAsync(new OffsetPipeSecureFileCallable(p, offset));
return new java.util.zip.GZIPInputStream(p.getIn());
}
-
+
private static class OffsetPipeSecureFileCallable extends MasterToSlaveFileCallable {
private static final long serialVersionUID = 1L;
-
+
private Pipe p;
private long offset;
-
+
private OffsetPipeSecureFileCallable(Pipe p, long offset) {
this.p = p;
this.offset = offset;
}
-
+
@Override
public Void invoke(File f, VirtualChannel channel) throws IOException {
try (OutputStream os = p.getOut();
@@ -2275,9 +2275,9 @@ public Void invoke(File f, VirtualChannel channel) throws IOException {
*/
public String readToString() throws IOException, InterruptedException {
return act(new ReadToString());
- }
+ }
private static class ReadToString extends MasterToSlaveFileCallable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
@Override
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
return new String(Files.readAllBytes(fileToPath(f)), Charset.defaultCharset());
@@ -2364,9 +2364,9 @@ public String invoke(File f, VirtualChannel channel) throws IOException {
* be on the some host
*/
public void renameTo(final FilePath target) throws IOException, InterruptedException {
- if(this.channel != target.channel) {
- throw new IOException("renameTo target must be on the same host");
- }
+ if(this.channel != target.channel) {
+ throw new IOException("renameTo target must be on the same host");
+ }
act(new RenameTo(target));
}
private static class RenameTo extends MasterToSlaveFileCallable {
@@ -2536,10 +2536,10 @@ interface RemoteCopier {
/**
* Copies the contents of this directory recursively into the specified target directory.
- *
+ *
* @return
* the number of files copied.
- * @since 1.312
+ * @since 1.312
*/
public int copyRecursiveTo(FilePath target) throws IOException, InterruptedException {
return copyRecursiveTo("**/*",target);
@@ -2685,8 +2685,8 @@ public void visit(File f, String relativePath) throws IOException {
if (exceptionEncountered) {
Files.copy(fileToPath(f), targetPath, StandardCopyOption.REPLACE_EXISTING);
if (!logMessageShown) {
- LOGGER.log(Level.INFO,
- "JENKINS-52325: Jenkins failed to retain attributes when copying to {0}, so proceeding without attributes.",
+ LOGGER.log(Level.INFO,
+ "JENKINS-52325: Jenkins failed to retain attributes when copying to {0}, so proceeding without attributes.",
dest.getAbsolutePath());
logMessageShown = true;
}
@@ -2695,14 +2695,14 @@ public void visit(File f, String relativePath) throws IOException {
}
}
private boolean tryCopyWithAttributes(File f, Path targetPath) {
- try {
+ try {
Files.copy(fileToPath(f), targetPath,
StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
LOGGER.log(Level.FINE, "Unable to copy: {0}", e.getMessage());
return false;
}
- return true;
+ return true;
}
@Override
public boolean understandsSymlink() {
@@ -2958,7 +2958,7 @@ public String invoke(File dir, VirtualChannel channel) throws IOException, Inter
final String fileMask = tokens.nextToken().trim();
if(hasMatch(dir,fileMask,caseSensitive))
continue; // no error on this portion
-
+
// JENKINS-5253 - if we can get some match in case insensitive mode
// and user requested case sensitive match, notify the user
if (caseSensitive && hasMatch(dir, fileMask, false)) {
@@ -3126,7 +3126,7 @@ private UrlFactory getUrlFactory() {
public static FormValidation validateFileMask(@CheckForNull FilePath path, String value) throws IOException {
return FilePath.validateFileMask(path, value, true);
}
-
+
/**
* Shortcut for {@link #validateFileMask(String,boolean,boolean)} with {@code errorIfNotExist} true, as the left-hand side can be null.
*/
@@ -3136,14 +3136,14 @@ public static FormValidation validateFileMask(@CheckForNull FilePath path, Strin
}
/**
- * Short for {@code validateFileMask(value, true, true)}
+ * Short for {@code validateFileMask(value, true, true)}
*/
public FormValidation validateFileMask(String value) throws IOException {
return validateFileMask(value, true, true);
}
-
+
/**
- * Short for {@code validateFileMask(value, errorIfNotExist, true)}
+ * Short for {@code validateFileMask(value, errorIfNotExist, true)}
*/
public FormValidation validateFileMask(String value, boolean errorIfNotExist) throws IOException {
return validateFileMask(value, errorIfNotExist, true);
@@ -3226,7 +3226,7 @@ public FormValidation validateRelativePath(String value, boolean errorIfNotExist
}
}
- String msg = expectingFile ? Messages.FilePath_validateRelativePath_noSuchFile(value) :
+ String msg = expectingFile ? Messages.FilePath_validateRelativePath_noSuchFile(value) :
Messages.FilePath_validateRelativePath_noSuchDirectory(value);
if(errorIfNotExist) return FormValidation.error(msg);
else return FormValidation.warning(msg);
@@ -3266,7 +3266,7 @@ public VirtualChannel getChannel() {
}
/**
- * Returns true if this {@link FilePath} represents a remote file.
+ * Returns true if this {@link FilePath} represents a remote file.
*/
public boolean isRemote() {
return channel!=null;
@@ -3308,8 +3308,9 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
private static final long serialVersionUID = 1L;
- @SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "TODO needs triage")
- public static int SIDE_BUFFER_SIZE = 1024;
+ @Restricted(NoExternalUse.class)
+ @RestrictedSince("TODO")
+ public static final int SIDE_BUFFER_SIZE = 1024;
private static final Logger LOGGER = Logger.getLogger(FilePath.class.getName());
@@ -3424,7 +3425,7 @@ public ExplicitlySpecifiedDirScanner(Map files) {
new NamingThreadFactory(new DaemonThreadFactory(), "FilePath.localPool"))
));
-
+
/**
* Channel to the current instance.
*/
@@ -3490,7 +3491,7 @@ public Boolean invoke(@NonNull File parentFile, @NonNull VirtualChannel channel)
if (new File(potentialChildRelativePath).isAbsolute()) {
throw new IllegalArgumentException("Only a relative path is supported, the given path is absolute: " + potentialChildRelativePath);
}
-
+
Path parentAbsolutePath = Util.fileToPath(parentFile.getAbsoluteFile());
Path parentRealPath;
try {
@@ -3538,7 +3539,7 @@ public Boolean invoke(@NonNull File parentFile, @NonNull VirtualChannel channel)
}
} catch (NoSuchFileException e) {
// nonexistent file / Windows Server 2016 + MSFT docker
- // in case this folder / file will be copied somewhere else,
+ // in case this folder / file will be copied somewhere else,
// it becomes the responsibility of that system to check the isDescendant with the existing links
// we are not taking the parentRealPath to avoid possible problem
Path child = currentFileAbsolutePath.normalize();
@@ -3560,7 +3561,7 @@ public Boolean invoke(@NonNull File parentFile, @NonNull VirtualChannel channel)
}
return current;
}
-
+
private @NonNull Path windowsToRealPath(@NonNull Path path) throws IOException {
try {
return path.toRealPath();
diff --git a/core/src/main/java/hudson/Launcher.java b/core/src/main/java/hudson/Launcher.java
index 57de28f89d5e..5b67208c5c93 100644
--- a/core/src/main/java/hudson/Launcher.java
+++ b/core/src/main/java/hudson/Launcher.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly, CloudBees, Inc.
- *
+ *
* 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
@@ -85,7 +85,7 @@
*
*
* @author Kohsuke Kawaguchi
- * @see FilePath#createLauncher(TaskListener)
+ * @see FilePath#createLauncher(TaskListener)
*/
public abstract class Launcher {
@@ -146,7 +146,7 @@ public VirtualChannel getChannel() {
/**
* Gets the {@link TaskListener} that this launcher uses to
* report the commands that it's executing.
- *
+ *
* @return Task listener
*/
@NonNull
@@ -289,7 +289,7 @@ public boolean quiet() {
/**
* Sets the current directory.
- *
+ *
* @param workDir Work directory to be used.
* If {@code null}, the default/current directory will be used by the process starter
* @return {@code this}
@@ -314,8 +314,8 @@ public FilePath pwd() {
/**
* Sets STDOUT destination.
- *
- * @param out Output stream.
+ *
+ * @param out Output stream.
* Use {@code null} to send STDOUT to {@code /dev/null}.
* @return {@code this}
*/
@@ -327,7 +327,7 @@ public ProcStarter stdout(@CheckForNull OutputStream out) {
/**
* Sends the stdout to the given {@link TaskListener}.
- *
+ *
* @param out Task listener (must be safely remotable)
* @return {@code this}
*/
@@ -339,7 +339,7 @@ public ProcStarter stdout(@NonNull TaskListener out) {
/**
* Gets current STDOUT destination.
- *
+ *
* @return STDOUT output stream. {@code null} if STDOUT is suppressed or undefined.
*/
@CheckForNull
@@ -358,7 +358,7 @@ public ProcStarter stderr(@CheckForNull OutputStream err) {
/**
* Gets current STDERR destination.
- *
+ *
* @return STDERR output stream. {@code null} if suppressed or undefined.
*/
@CheckForNull
@@ -369,7 +369,7 @@ public OutputStream stderr() {
/**
* Controls where the stdin of the process comes from.
* By default, {@code /dev/null}.
- *
+ *
* @return {@code this}
*/
@NonNull
@@ -380,7 +380,7 @@ public ProcStarter stdin(@CheckForNull InputStream in) {
/**
* Gets current STDIN destination.
- *
+ *
* @return STDIN output stream. {@code null} if suppressed or undefined.
*/
@CheckForNull
@@ -395,7 +395,7 @@ public InputStream stdin() {
* In addition to what the current process
* is inherited (if this is going to be launched from a agent agent, that
* becomes the "current" process), these variables will be also set.
- *
+ *
* @param overrides Environment variables to be overridden
* @return {@code this}
*/
@@ -407,7 +407,7 @@ public ProcStarter envs(@NonNull Map overrides) {
/**
* @param overrides
* List of "VAR=VALUE". See {@link #envs(Map)} for the semantics.
- *
+ *
* @return {@code this}
*/
public ProcStarter envs(@CheckForNull String... overrides) {
@@ -425,7 +425,7 @@ public ProcStarter envs(@CheckForNull String... overrides) {
/**
* Gets a list of environment variables to be set.
* Returns an empty array if envs field has not been initialized.
- *
+ *
* @return If initialized, returns a copy of internal envs array. Otherwise - a new empty array.
*/
@NonNull
@@ -470,7 +470,7 @@ public ProcStarter readStderr() {
* Indicates that the caller will directly write to the child process {@link #stdin()} via {@link Proc#getStdin()}.
* (Whereas by default you call {@link #stdin(InputStream)}
* and let Jenkins pump your {@link InputStream} of choosing to stdin.)
- *
+ *
* @return {@code this}
* @since 1.399
*/
@@ -518,7 +518,7 @@ public int join() throws IOException, InterruptedException {
// The logging around procHolderForJoin prevents the preliminary object deallocation we saw in JENKINS-23271
final Proc procHolderForJoin = start();
LOGGER.log(Level.FINER, "Started the process {0}", procHolderForJoin);
-
+
if (procHolderForJoin instanceof ProcWithJenkins23271Patch) {
return procHolderForJoin.join();
} else {
@@ -762,7 +762,7 @@ public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, O
*
* When the returned channel is terminated, the process will be killed.
*
- * @param cmd
+ * @param cmd
* The commands.
* @param out
* Where the stderr from the launched process will be sent.
@@ -774,7 +774,7 @@ public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, O
* is inherited (if this is going to be launched from an agent, that
* becomes the "current" process), these variables will be also set.
*/
- public abstract Channel launchChannel(@NonNull String[] cmd, @NonNull OutputStream out,
+ public abstract Channel launchChannel(@NonNull String[] cmd, @NonNull OutputStream out,
@CheckForNull FilePath workDir, @NonNull Map envVars) throws IOException, InterruptedException;
/**
@@ -831,7 +831,7 @@ protected final void maskedPrintCommandLine(@NonNull List cmd, @CheckFor
printCommandLine(cmd.toArray(new String[0]),workDir);
return;
}
-
+
assert mask.length == cmd.size();
final String[] masked = new String[cmd.size()];
for (int i = 0; i < cmd.size(); i++) {
@@ -843,14 +843,14 @@ protected final void maskedPrintCommandLine(@NonNull List cmd, @CheckFor
}
printCommandLine(masked, workDir);
}
-
+
protected final void maskedPrintCommandLine(@NonNull String[] cmd, @NonNull boolean[] mask, @CheckForNull FilePath workDir) {
maskedPrintCommandLine(Arrays.asList(cmd),mask,workDir);
}
/**
* Returns a decorated {@link Launcher} for the given node.
- *
+ *
* @param node Node for which this launcher is created.
* @return Decorated instance of the Launcher.
*/
@@ -877,7 +877,7 @@ public final Launcher decorateByPrefix(final String... prefix) {
public boolean isUnix() {
return outer.isUnix();
}
-
+
@Override
public Proc launch(ProcStarter starter) throws IOException {
starter.commands.addAll(0,Arrays.asList(prefix));
@@ -987,7 +987,7 @@ public Proc launch(ProcStarter ps) throws IOException {
// replace variables in command line
String[] jobCmd = new String[ps.commands.size()];
for ( int idx = 0 ; idx < jobCmd.length; idx++ )
- jobCmd[idx] = jobEnv.expand(ps.commands.get(idx));
+ jobCmd[idx] = jobEnv.expand(ps.commands.get(idx));
return new LocalProc(jobCmd, Util.mapToEnv(jobEnv),
ps.reverseStdin ?LocalProc.SELFPUMP_INPUT:ps.stdin,
@@ -1111,7 +1111,7 @@ public Proc launch(ProcStarter ps) throws IOException {
final OutputStream out = ps.stdout == null || ps.stdoutListener != null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stdout));
final OutputStream err = ps.stderr==null ? null : new RemoteOutputStream(new CloseProofOutputStream(ps.stderr));
final InputStream in = ps.stdin == null || ps.stdin == NULL_INPUT_STREAM ? null : new RemoteInputStream(ps.stdin, false);
-
+
final FilePath psPwd = ps.pwd;
final String workDir = psPwd==null ? null : psPwd.getRemote();
@@ -1230,14 +1230,14 @@ public OutputStream getStdin() {
}
}
}
-
+
/**
- * A launcher which delegates to a provided inner launcher.
+ * A launcher which delegates to a provided inner launcher.
* Allows subclasses to only implement methods they want to override.
- * Originally, this launcher has been implemented in
+ * Originally, this launcher has been implemented in
*
* Custom Tools Plugin.
- *
+ *
* @author rcampbell
* @author Oleg Nenashev, Synopsys Inc.
* @since 1.568
@@ -1301,9 +1301,9 @@ public VirtualChannel getChannel() {
@Override
public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
- return inner.launch(cmd, env, in, out, workDir);
+ return inner.launch(cmd, env, in, out, workDir);
}
-
+
/**
* Gets nested launcher.
* @return Inner launcher
@@ -1311,7 +1311,7 @@ public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out,
@NonNull
public Launcher getInner() {
return inner;
- }
+ }
}
public static class IOTriplet implements Serializable {
@@ -1328,7 +1328,7 @@ public interface RemoteProcess {
int join() throws InterruptedException, IOException;
void kill() throws IOException, InterruptedException;
boolean isAlive() throws IOException, InterruptedException;
-
+
@NonNull
IOTriplet getIOtriplet();
}
@@ -1350,8 +1350,8 @@ private static class RemoteLaunchCallable extends MasterToSlaveCallable cmd, @CheckForNull boolean[] masks, @CheckForNull String[] env,
@CheckForNull InputStream in, boolean reverseStdin,
- @CheckForNull OutputStream out, boolean reverseStdout,
- @CheckForNull OutputStream err, boolean reverseStderr,
+ @CheckForNull OutputStream out, boolean reverseStdout,
+ @CheckForNull OutputStream err, boolean reverseStderr,
boolean quiet, @CheckForNull String workDir, @NonNull TaskListener listener, @CheckForNull TaskListener stdoutListener) {
this.cmd = new ArrayList<>(cmd);
this.masks = masks;
@@ -1448,7 +1448,7 @@ private static class RemoteChannelLaunchCallable extends MasterToSlaveCallable envOverrides;
- RemoteChannelLaunchCallable(@NonNull String[] cmd, @NonNull Pipe out, @NonNull OutputStream err,
+ RemoteChannelLaunchCallable(@NonNull String[] cmd, @NonNull Pipe out, @NonNull OutputStream err,
@CheckForNull String workDir, @NonNull Map envOverrides) {
this.cmd = cmd;
this.out = out;
@@ -1501,7 +1501,7 @@ private static EnvVars inherit(@NonNull Map overrides) {
m.overrideExpandingAll(overrides);
return m;
}
-
+
/**
* Debug option to display full current path instead of just the last token.
*/
diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java
index 99313e18c703..9b9f38146527 100644
--- a/core/src/main/java/hudson/PluginManager.java
+++ b/core/src/main/java/hudson/PluginManager.java
@@ -219,7 +219,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
private enum PMConstructor {
JENKINS {
@Override
- @NonNull
+ @NonNull
PluginManager doCreate(@NonNull Class extends PluginManager> klass,
@NonNull Jenkins jenkins) throws ReflectiveOperationException {
return klass.getConstructor(Jenkins.class).newInstance(jenkins);
@@ -1090,7 +1090,7 @@ protected void copyBundledPlugin(URL src, String fileName) throws IOException {
}
return null;
}
-
+
/**
* Retrieves input stream for the Manifest url.
* The method intelligently handles the case of {@link JarURLConnection} pointing to files within JAR.
@@ -1103,11 +1103,11 @@ protected void copyBundledPlugin(URL src, String fileName) throws IOException {
URLConnection uc = url.openConnection();
InputStream in = null;
// Magic, which allows to avoid using stream generated for JarURLConnection.
- // It prevents getting into JENKINS-37332 due to the file descriptor leak
+ // It prevents getting into JENKINS-37332 due to the file descriptor leak
if (uc instanceof JarURLConnection) {
final JarURLConnection jarURLConnection = (JarURLConnection) uc;
final String entryName = jarURLConnection.getEntryName();
-
+
try(JarFile jarFile = jarURLConnection.getJarFile()) {
final JarEntry entry = entryName != null && jarFile != null ? jarFile.getJarEntry(entryName) : null;
if (entry != null) {
@@ -1121,16 +1121,16 @@ protected void copyBundledPlugin(URL src, String fileName) throws IOException {
url);
}
}
- }
+ }
// If input stream is undefined, use the default implementation
if (in == null) {
in = url.openStream();
}
-
+
return in;
}
-
+
/**
* Retrieves modification date of the specified file.
* The method intelligently handles the case of {@link JarURLConnection} pointing to files within JAR.
@@ -1141,7 +1141,7 @@ protected void copyBundledPlugin(URL src, String fileName) throws IOException {
@NonNull
/*package*/ static long getModificationDate(@NonNull URL url) throws IOException {
URLConnection uc = url.openConnection();
-
+
// It prevents file descriptor leak if the URL references a file within JAR
// See JENKINS-37332 for more info
// The code idea is taken from https://github.com/jknack/handlebars.java/pull/394
@@ -1160,7 +1160,7 @@ protected void copyBundledPlugin(URL src, String fileName) throws IOException {
}
}
}
-
+
// Fallbak to the default implementation
return uc.getLastModified();
}
@@ -1183,31 +1183,31 @@ private void rename(File legacyFile, File newFile) throws IOException {
* Creates a hudson.PluginStrategy, looking at the corresponding system property.
*/
protected PluginStrategy createPluginStrategy() {
- String strategyName = SystemProperties.getString(PluginStrategy.class.getName());
- if (strategyName != null) {
- try {
- Class> klazz = getClass().getClassLoader().loadClass(strategyName);
- Object strategy = klazz.getConstructor(PluginManager.class)
- .newInstance(this);
- if (strategy instanceof PluginStrategy) {
- LOGGER.info("Plugin strategy: " + strategyName);
- return (PluginStrategy) strategy;
- } else {
- LOGGER.warning("Plugin strategy (" + strategyName +
- ") is not an instance of hudson.PluginStrategy");
- }
- } catch (ClassNotFoundException e) {
- LOGGER.warning("Plugin strategy class not found: "
- + strategyName);
- } catch (Exception e) {
- LOGGER.log(WARNING, "Could not instantiate plugin strategy: "
- + strategyName + ". Falling back to ClassicPluginStrategy", e);
- }
- LOGGER.info("Falling back to ClassicPluginStrategy");
- }
-
- // default and fallback
- return new ClassicPluginStrategy(this);
+ String strategyName = SystemProperties.getString(PluginStrategy.class.getName());
+ if (strategyName != null) {
+ try {
+ Class> klazz = getClass().getClassLoader().loadClass(strategyName);
+ Object strategy = klazz.getConstructor(PluginManager.class)
+ .newInstance(this);
+ if (strategy instanceof PluginStrategy) {
+ LOGGER.info("Plugin strategy: " + strategyName);
+ return (PluginStrategy) strategy;
+ } else {
+ LOGGER.warning("Plugin strategy (" + strategyName +
+ ") is not an instance of hudson.PluginStrategy");
+ }
+ } catch (ClassNotFoundException e) {
+ LOGGER.warning("Plugin strategy class not found: "
+ + strategyName);
+ } catch (Exception e) {
+ LOGGER.log(WARNING, "Could not instantiate plugin strategy: "
+ + strategyName + ". Falling back to ClassicPluginStrategy", e);
+ }
+ LOGGER.info("Falling back to ClassicPluginStrategy");
+ }
+
+ // default and fallback
+ return new ClassicPluginStrategy(this);
}
public PluginStrategy getPluginStrategy() {
@@ -1347,7 +1347,7 @@ public synchronized void stop() {
public static boolean isNonMetaLabel(String label) {
return !("adopt-this-plugin".equals(label) || "deprecated".equals(label));
}
-
+
@Restricted(NoExternalUse.class)
public HttpResponse doPluginsSearch(@QueryParameter String query, @QueryParameter Integer limit) {
List plugins = new ArrayList<>();
@@ -1458,10 +1458,10 @@ public HttpResponse doPluginsSearch(@QueryParameter String query, @QueryParamete
JSONArray mappedPlugins = new JSONArray();
mappedPlugins.addAll(plugins);
-
+
return hudson.util.HttpResponses.okJSON(mappedPlugins);
}
-
+
/**
* Get the list of all plugins - available and installed.
* @return The list of all plugins - available and installed.
@@ -1498,8 +1498,8 @@ public HttpResponse doPlugins() {
for (UpdateSite.Plugin plugin: site.getAvailables()) {
JSONObject pluginInfo = allPlugins.get(plugin.name);
if(pluginInfo == null) {
- pluginInfo = new JSONObject();
- pluginInfo.put("installed", false);
+ pluginInfo = new JSONObject();
+ pluginInfo.put("installed", false);
}
pluginInfo.put("name", plugin.name);
pluginInfo.put("title", plugin.getDisplayName());
@@ -1532,9 +1532,9 @@ public HttpResponse doUpdateSources(StaplerRequest req) throws IOException {
return new HttpRedirect("./sites");
}
-
+
/**
- * Called to progress status beyond installing plugins, e.g. if
+ * Called to progress status beyond installing plugins, e.g. if
* there were failures that prevented installation from naturally proceeding
*/
@RequirePOST
@@ -1651,7 +1651,7 @@ private List> install(@NonNull Collection, ModelObject {
* The snapshot of {@code disableFile.exists()} as of the start up.
*/
private final boolean active;
-
+
private boolean hasCycleDependency = false;
private final List dependencies;
@@ -384,11 +384,11 @@ public boolean isDeprecated() {
/**
* Inject the specified jar file(s) to the plugins classpath.
*
Warning: This is advanced usage that you should not be needed in 99.9% of all cases, any jar insertion
- * should happen early into the plugins lifecycle to prevent classloading issues in dependent plugins.
+ * should happen early into the plugins lifecycle to prevent classloading issues in dependent plugins.
*
* Rather than use this functionality it is to have co-operative behaviour between any consumer of the libraries and load the classes in a separate {@link ClassLoader}.
* you can expose third-party libraries from a dynamic location in various ways, such as:
- *
+ *
*
*
You could split your plugin into two modules:
*
@@ -409,7 +409,7 @@ public boolean isDeprecated() {
* For a concrete example see the database
* plugin. *
- *
+ *
* @throws Exception if the File could not be inserted into the classpath for some reason.
* @since 2.313
*/
@@ -467,7 +467,7 @@ public Dependency(String s) {
@Override
public String toString() {
return shortName + " (" + version + ")" + (optional ? " optional" : "");
- }
+ }
}
/**
@@ -484,18 +484,18 @@ public String toString() {
* @param dependencies a list of mandatory dependencies
* @param optionalDependencies a list of optional dependencies
*/
- public PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL baseResourceURL,
- ClassLoader classLoader, File disableFile,
- List dependencies, List optionalDependencies) {
+ public PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL baseResourceURL,
+ ClassLoader classLoader, File disableFile,
+ List dependencies, List optionalDependencies) {
this.parent = parent;
- this.manifest = manifest;
- this.shortName = Util.intern(computeShortName(manifest, archive.getName()));
- this.baseResourceURL = baseResourceURL;
- this.classLoader = classLoader;
- this.disableFile = disableFile;
- this.active = !disableFile.exists();
- this.dependencies = dependencies;
- this.optionalDependencies = optionalDependencies;
+ this.manifest = manifest;
+ this.shortName = Util.intern(computeShortName(manifest, archive.getName()));
+ this.baseResourceURL = baseResourceURL;
+ this.classLoader = classLoader;
+ this.disableFile = disableFile;
+ this.active = !disableFile.exists();
+ this.dependencies = dependencies;
+ this.optionalDependencies = optionalDependencies;
for (Dependency d : optionalDependencies) {
assert d.optional : d + " included among optionalDependencies of " + shortName + " but was not marked optional";
}
@@ -608,7 +608,7 @@ public String getUrl() {
List siteMetadataList = getInfoFromAllSites();
String firstSiteUrl = null;
if (!siteMetadataList.isEmpty()) {
- firstSiteUrl = siteMetadataList.get(0).wiki;
+ firstSiteUrl = siteMetadataList.get(0).wiki;
if (allUrlsMatch(firstSiteUrl, siteMetadataList)) {
return firstSiteUrl;
}
@@ -618,7 +618,7 @@ public String getUrl() {
// use manifest (since maven-hpi-plugin 1.30)
String url = manifest.getMainAttributes().getValue("Url");
if (url != null) {
- return url;
+ return url;
}
return firstSiteUrl;
}
@@ -627,7 +627,7 @@ private boolean allUrlsMatch(String url, List uiList) {
return uiList.stream().allMatch(k -> k.wiki != null && k.wiki.equals(url));
}
- @Override
+ @Override
public String toString() {
return "Plugin:" + getShortName();
}
@@ -718,7 +718,7 @@ public boolean isOlderThan(VersionNumber v) {
return getVersionNumber().compareTo(v) < 0;
} catch (IllegalArgumentException e) {
// if we can't figure out our current version, it probably means it's very old,
- // since the version information is missing only from the very old plugins
+ // since the version information is missing only from the very old plugins
return true;
}
}
@@ -889,7 +889,7 @@ private Set dependentsToCheck(PluginDisableStrategy strategy) {
public boolean isActive() {
return active && !hasCycleDependency();
}
-
+
public boolean hasCycleDependency(){
return hasCycleDependency;
}
@@ -1056,7 +1056,7 @@ public UpdateSite.Plugin getUpdateInfo() {
if(p!=null && p.isNewerThan(getVersion())) return p;
return null;
}
-
+
/**
* returns the {@link hudson.model.UpdateSite.Plugin} object, or null.
*/
@@ -1083,7 +1083,7 @@ private List getInfoFromAllSites() {
public boolean hasUpdate() {
return getUpdateInfo()!=null;
}
-
+
@Exported
@Deprecated // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ
public boolean isPinned() {
@@ -1376,7 +1376,7 @@ public HttpResponse doUnpin() throws IOException {
@RequirePOST
public HttpResponse doDoUninstall() throws IOException {
Jenkins jenkins = Jenkins.get();
-
+
jenkins.checkPermission(Jenkins.ADMINISTER);
Files.deleteIfExists(Util.fileToPath(archive));
diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java
index df22f9faab86..e66820214612 100644
--- a/core/src/main/java/hudson/Util.java
+++ b/core/src/main/java/hudson/Util.java
@@ -1188,7 +1188,7 @@ public static String getFileName(@NonNull String filePath) {
/**
* Concatenate multiple strings by inserting a separator.
- * @deprecated since TODO; use {@link String#join(CharSequence, Iterable)}
+ * @deprecated since 2.292; use {@link String#join(CharSequence, Iterable)}
*/
@Deprecated
@NonNull
diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java
index f22fb7b08e7a..82aee9f2f9ac 100644
--- a/core/src/main/java/hudson/WebAppMain.java
+++ b/core/src/main/java/hudson/WebAppMain.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Tom Huybrechts
- *
+ *
* 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
@@ -29,7 +29,6 @@
import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider;
import com.thoughtworks.xstream.core.JVM;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.Hudson;
import hudson.security.ACL;
import hudson.security.ACLContext;
@@ -97,7 +96,7 @@ public class WebAppMain implements ServletContextListener {
*
* The SecurityRealm should be corrected but this is a hardening in Jenkins core.
*
- * As this property is read during startup, you will not be able to change it at runtime
+ * As this property is read during startup, you will not be able to change it at runtime
* depending on your application server (not possible with Jetty nor Tomcat)
*
* When running hpi:run, the default tracking is COOKIE+URL.
@@ -108,7 +107,7 @@ public class WebAppMain implements ServletContextListener {
public static final String FORCE_SESSION_TRACKING_BY_COOKIE_PROP = WebAppMain.class.getName() + ".forceSessionTrackingByCookie";
private final RingBufferLogHandler handler = new RingBufferLogHandler(WebAppMain.getDefaultRingBufferSize()) {
-
+
@Override public synchronized void publish(LogRecord record) {
if (record.getLevel().intValue() >= Level.INFO.intValue()) {
super.publish(record);
@@ -141,7 +140,7 @@ public void contextInitialized(ServletContextEvent event) {
if (Main.isDevelopmentMode && System.getProperty("java.util.logging.config.file") == null) {
try {
Formatter formatter = (Formatter) Class.forName("io.jenkins.lib.support_log_formatter.SupportLogFormatter").newInstance();
- for (Handler h : java.util.logging.Logger.getLogger("").getHandlers()) {
+ for (Handler h : Logger.getLogger("").getHandlers()) {
if (h instanceof ConsoleHandler) {
((ConsoleHandler) h).setFormatter(formatter);
}
@@ -240,7 +239,6 @@ public Locale get() {
final File _home = home;
initThread = new Thread("Jenkins initialization thread") {
- @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification = "TODO needs triage")
@Override
public void run() {
boolean success = false;
@@ -253,7 +251,7 @@ public void run() {
context.setAttribute(APP, instance);
- BootFailure.getBootFailureFile(_home).delete();
+ Files.deleteIfExists(BootFailure.getBootFailureFile(_home).toPath());
// at this point we are open for business and serving requests normally
LOGGER.info("Jenkins is fully up and running");
@@ -301,10 +299,9 @@ public static void installExpressionFactory(ServletContextEvent event) {
JellyFacet.setExpressionFactory(event, new ExpressionFactory2());
}
- /**
+ /**
* Installs log handler to monitor all Hudson logs.
*/
- @SuppressFBWarnings(value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE", justification = "TODO needs triage")
private void installLogger() {
Jenkins.logRecords = handler.getView();
Logger.getLogger("").addHandler(handler);
@@ -329,7 +326,7 @@ public FileAndDescription(File file,String description) {
*
* People makes configuration mistakes, so we are trying to be nice
* with those by doing {@link String#trim()}.
- *
+ *
*
* @return the File alongside with some description to help the user troubleshoot issues
*/
diff --git a/core/src/main/java/hudson/cli/declarative/CLIMethod.java b/core/src/main/java/hudson/cli/declarative/CLIMethod.java
index 2aecb963df3f..13ddffbf5d2f 100644
--- a/core/src/main/java/hudson/cli/declarative/CLIMethod.java
+++ b/core/src/main/java/hudson/cli/declarative/CLIMethod.java
@@ -63,7 +63,7 @@
@Documented
public @interface CLIMethod {
/**
- * CLI command name. Used as {@link CLICommand#getName()}
+ * CLI command name. Used as {@link CLICommand#getName()}
*/
String name();
diff --git a/core/src/main/java/hudson/console/AnnotatedLargeText.java b/core/src/main/java/hudson/console/AnnotatedLargeText.java
index dafff632d305..d3f8aa3301bd 100644
--- a/core/src/main/java/hudson/console/AnnotatedLargeText.java
+++ b/core/src/main/java/hudson/console/AnnotatedLargeText.java
@@ -103,7 +103,7 @@ public void doProgressiveText(StaplerRequest req, StaplerResponse rsp) throws IO
/**
* For reusing code between text/html and text/plain, we run them both through the same code path
- * and use this request attribute to differentiate.
+ * and use this request attribute to differentiate.
*/
private boolean isHtml() {
StaplerRequest req = Stapler.getCurrentRequest();
diff --git a/core/src/main/java/hudson/init/Initializer.java b/core/src/main/java/hudson/init/Initializer.java
index 07f328a20eef..61b1c272be7c 100644
--- a/core/src/main/java/hudson/init/Initializer.java
+++ b/core/src/main/java/hudson/init/Initializer.java
@@ -51,7 +51,7 @@ public static void init() throws IOException {
* The method in question can be either {@code static} or an instance method. When used with instance
* methods, those methods have to be on a class annotated with {@link Extension} and marked as
* {@link #after()} {@link InitMilestone#PLUGINS_PREPARED}.
- *
+ *
* @author Kohsuke Kawaguchi
*/
@Indexed
@@ -99,7 +99,7 @@ public static void init() throws IOException {
/**
* Should the failure in this task prevent Hudson from starting up?
*
- * @see Task#failureIsFatal()
+ * @see Task#failureIsFatal()
*/
boolean fatal() default true;
}
diff --git a/core/src/main/java/hudson/init/impl/GroovyInitScript.java b/core/src/main/java/hudson/init/impl/GroovyInitScript.java
index fb37be78b264..69a36cc18e3e 100644
--- a/core/src/main/java/hudson/init/impl/GroovyInitScript.java
+++ b/core/src/main/java/hudson/init/impl/GroovyInitScript.java
@@ -32,7 +32,7 @@
/**
* Run the initialization script, if it exists.
* It runs strictly after the initialization of other tasks during the last initialization milestone.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class GroovyInitScript {
diff --git a/core/src/main/java/hudson/lifecycle/RestartNotSupportedException.java b/core/src/main/java/hudson/lifecycle/RestartNotSupportedException.java
index 08bae8291c06..50f87f457044 100644
--- a/core/src/main/java/hudson/lifecycle/RestartNotSupportedException.java
+++ b/core/src/main/java/hudson/lifecycle/RestartNotSupportedException.java
@@ -2,7 +2,7 @@
/**
* Indicates that the {@link Lifecycle} doesn't support restart.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class RestartNotSupportedException extends Exception {
diff --git a/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java b/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
index 8612f2cf0d6f..0eb1b43cb388 100644
--- a/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
+++ b/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -43,7 +43,7 @@
/**
* {@link Lifecycle} for Hudson installed as Windows service.
- *
+ *
* @author Kohsuke Kawaguchi
* @see WindowsInstallerLink
*/
@@ -143,10 +143,10 @@ public void restart() throws IOException, InterruptedException {
if(r!=0)
throw new IOException(baos.toString());
}
-
+
private static File getBaseDir() {
File baseDir;
-
+
String baseEnv = System.getenv("BASE");
if (baseEnv != null) {
baseDir = new File(baseEnv);
diff --git a/core/src/main/java/hudson/logging/LogRecorderManager.java b/core/src/main/java/hudson/logging/LogRecorderManager.java
index 3d7164a2dcd9..8a13849f3f89 100644
--- a/core/src/main/java/hudson/logging/LogRecorderManager.java
+++ b/core/src/main/java/hudson/logging/LogRecorderManager.java
@@ -32,6 +32,7 @@
import hudson.RestrictedSince;
import hudson.init.Initializer;
import hudson.model.AbstractModelObject;
+import hudson.model.Failure;
import hudson.model.RSS;
import hudson.util.CopyOnWriteMap;
import java.io.File;
@@ -39,12 +40,14 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.Function;
import java.util.logging.Level;
+import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.servlet.ServletException;
@@ -170,8 +173,11 @@ public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse
/**
* Configure the logging level.
*/
- @SuppressFBWarnings(value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE", justification = "TODO needs triage")
@RequirePOST
+ @SuppressFBWarnings(
+ value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE",
+ justification =
+ "if the logger is known, then we have a reference to it in LogRecorder#loggers")
public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter String level) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
Level lv;
@@ -179,8 +185,14 @@ public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter
lv = null;
else
lv = Level.parse(level.toUpperCase(Locale.ENGLISH));
- Logger.getLogger(name).setLevel(lv);
- return new HttpRedirect("levels");
+ Logger target;
+ if (Collections.list(LogManager.getLogManager().getLoggerNames()).contains(name)
+ && (target = Logger.getLogger(name)) != null) {
+ target.setLevel(lv);
+ return new HttpRedirect("levels");
+ } else {
+ throw new Failure(Messages.LogRecorderManager_LoggerNotFound(name));
+ }
}
/**
diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java
index 07e965821e4f..a6ea4845b0db 100644
--- a/core/src/main/java/hudson/model/AbstractBuild.java
+++ b/core/src/main/java/hudson/model/AbstractBuild.java
@@ -462,7 +462,7 @@ protected Lease decideWorkspace(@NonNull Node n, WorkspaceList wsl) throws Inter
@Override
public Result run(@NonNull BuildListener listener) throws Exception {
final Node node = getCurrentNode();
-
+
assert builtOn==null;
builtOn = node.getNodeName();
hudsonVersion = Jenkins.VERSION;
@@ -502,7 +502,7 @@ public Result run(@NonNull BuildListener listener) throws Exception {
} else {
listener.getLogger().print(Messages.AbstractBuild_Building());
}
-
+
lease = decideWorkspace(node, Computer.currentComputer().getWorkspaceList());
workspace = lease.path.getRemote();
@@ -883,11 +883,11 @@ public boolean tearDown(AbstractBuild build, BuildListener listener) throws IOEx
}
}
- /*
+ /*
* No need to lock the entire AbstractBuild on change set calculation
*/
private transient Object changeSetLock = new Object();
-
+
/**
* Gets the changes incorporated into this build.
*
@@ -897,7 +897,7 @@ public boolean tearDown(AbstractBuild build, BuildListener listener) throws IOEx
@NonNull public ChangeLogSet extends ChangeLogSet.Entry> getChangeSet() {
synchronized (changeSetLock) {
if (scm==null) {
- scm = NullChangeLogParser.INSTANCE;
+ scm = NullChangeLogParser.INSTANCE;
}
}
@@ -973,13 +973,13 @@ public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedE
/**
* During the build, expose the environments contributed by {@link BuildWrapper}s and others.
- *
+ *
*
* Since 1.444, executor thread that's doing the build can access mutable underlying list,
* which allows the caller to add/remove environments. The recommended way of adding
* environment is through {@link BuildWrapper}, but this might be handy for build steps
* who wants to expose additional environment variables to the rest of the build.
- *
+ *
* @return can be empty list, but never null. Immutable.
* @since 1.437
*/
@@ -987,9 +987,9 @@ public EnvironmentList getEnvironments() {
Executor e = Executor.currentExecutor();
if (e!=null && e.getCurrentExecutable()==this) {
if (buildEnvironments==null) buildEnvironments = new ArrayList<>();
- return new EnvironmentList(buildEnvironments);
+ return new EnvironmentList(buildEnvironments);
}
-
+
return new EnvironmentList(buildEnvironments==null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList<>(buildEnvironments)));
}
@@ -1004,7 +1004,7 @@ public Calendar due() {
@Override public void addAction(Action a) {
super.addAction(a);
}
-
+
@SuppressWarnings("deprecation")
public List getPersistentActions(){
return super.getActions();
@@ -1036,7 +1036,7 @@ public Set getSensitiveBuildVariables() {
bw.makeSensitiveBuildVariables(this, s);
}
}
-
+
return s;
}
@@ -1394,7 +1394,7 @@ public void doStop(StaplerRequest req, StaplerResponse rsp) throws IOException,
*
* If we use this/executor/stop URL, it causes 404 if the build is already killed,
* as {@link #getExecutor()} returns null.
- *
+ *
* @since 1.489
*/
@RequirePOST
diff --git a/core/src/main/java/hudson/model/AbstractItem.java b/core/src/main/java/hudson/model/AbstractItem.java
index 58a1d90bc5cb..47a715a0aa12 100644
--- a/core/src/main/java/hudson/model/AbstractItem.java
+++ b/core/src/main/java/hudson/model/AbstractItem.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Daniel Dyer, Tom Huybrechts, Yahoo!, Inc.
- *
+ *
* 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
@@ -124,7 +124,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet
protected volatile String description;
private transient ItemGroup parent;
-
+
protected String displayName;
protected AbstractItem(ItemGroup parent, String name) {
@@ -168,7 +168,7 @@ public String getDisplayName() {
// if the displayName is not set, then return the name as we use to do
return getName();
}
-
+
/**
* This is intended to be used by the Job configuration pages where
* we want to return null if the display name is not set.
@@ -179,21 +179,21 @@ public String getDisplayName() {
public String getDisplayNameOrNull() {
return displayName;
}
-
+
/**
- * This method exists so that the Job configuration pages can use
+ * This method exists so that the Job configuration pages can use
* getDisplayNameOrNull so that nothing is shown in the display name text
* box if the display name is not set.
*/
public void setDisplayNameOrNull(String displayName) throws IOException {
setDisplayName(displayName);
}
-
+
public void setDisplayName(String displayName) throws IOException {
this.displayName = Util.fixEmptyAndTrim(displayName);
save();
}
-
+
@Override
public File getRootDir() {
return getParent().getRootDirFor(this);
@@ -488,7 +488,7 @@ public final String getFullDisplayName() {
if(n.length()==0) return getDisplayName();
else return n+" » "+getDisplayName();
}
-
+
/**
* Gets the display name of the current item relative to the given group.
*
@@ -500,7 +500,7 @@ public final String getFullDisplayName() {
public String getRelativeDisplayNameFrom(ItemGroup p) {
return Functions.getRelativeDisplayNameFrom(this, p);
}
-
+
/**
* This method only exists to disambiguate {@link #getRelativeNameFrom(ItemGroup)} and {@link #getRelativeNameFrom(Item)}
* @since 1.512
@@ -527,7 +527,7 @@ public void onLoad(ItemGroup extends Item> parent, String name) throws IOExcep
* to perform any implementation-specific work.
*
*
- *
+ *
*
* @param src
* Item from which it's copied from. The same type as {@code this}. Never null.
@@ -740,8 +740,8 @@ public void delete() throws IOException, InterruptedException {
final WorkUnit workUnit = e.getCurrentWorkUnit();
final Executable executable = workUnit != null ? workUnit.getExecutable() : null;
final SubTask subtask = executable != null ? getParentOf(executable) : null;
-
- if (subtask != null) {
+
+ if (subtask != null) {
Item item = Tasks.getItemOf(subtask);
while (item != null) {
if (item == this) {
diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java
index 48666d0bad24..cd669b8bb494 100644
--- a/core/src/main/java/hudson/model/AbstractProject.java
+++ b/core/src/main/java/hudson/model/AbstractProject.java
@@ -1105,7 +1105,7 @@ public AbstractProject getBuildingDownstream() {
Set unblockedTasks = Jenkins.get().getQueue().getUnblockedTasks();
for (AbstractProject tup : getTransitiveDownstreamProjects()) {
- if (tup!=this && (tup.isBuilding() || unblockedTasks.contains(tup)))
+ if (tup!=this && (tup.isBuilding() || unblockedTasks.contains(tup)))
return tup;
}
return null;
@@ -1122,7 +1122,7 @@ public AbstractProject getBuildingUpstream() {
Set unblockedTasks = Jenkins.get().getQueue().getUnblockedTasks();
for (AbstractProject tup : getTransitiveUpstreamProjects()) {
- if (tup!=this && (tup.isBuilding() || unblockedTasks.contains(tup)))
+ if (tup!=this && (tup.isBuilding() || unblockedTasks.contains(tup)))
return tup;
}
return null;
@@ -1932,10 +1932,10 @@ public FormValidation doCheckLabel(@AncestorInPath AbstractProject,?> project,
}
public FormValidation doCheckCustomWorkspace(@QueryParameter String customWorkspace){
- if(Util.fixEmptyAndTrim(customWorkspace)==null)
- return FormValidation.error(Messages.AbstractProject_CustomWorkspaceEmpty());
- else
- return FormValidation.ok();
+ if(Util.fixEmptyAndTrim(customWorkspace)==null)
+ return FormValidation.error(Messages.AbstractProject_CustomWorkspaceEmpty());
+ else
+ return FormValidation.ok();
}
public AutoCompletionCandidates doAutoCompleteUpstreamProjects(@QueryParameter String value) {
diff --git a/core/src/main/java/hudson/model/AperiodicWork.java b/core/src/main/java/hudson/model/AperiodicWork.java
index c275968168f4..4fd5e231072a 100644
--- a/core/src/main/java/hudson/model/AperiodicWork.java
+++ b/core/src/main/java/hudson/model/AperiodicWork.java
@@ -41,37 +41,37 @@
/**
* Extension point which allows scheduling a task with variable interval. Interval in evaluated every time before next
* task is scheduled by calling {@link #getRecurrencePeriod()}. Task to be scheduled is obtain by calling {@link #getNewInstance()}.
- *
+ *
*
* This class is similar to {@link PeriodicWork}. The main difference is in re-evaluating delay interval every time.
* See {@link PeriodicWork} for details. Analog of {@link AsyncPeriodicWork} is {@link AsyncAperiodicWork}.
- *
+ *
* @author vjuranek
* @since 1.410
*/
@SuppressFBWarnings(value="PREDICTABLE_RANDOM", justification = "The random is just used for an initial delay.")
public abstract class AperiodicWork extends SafeTimerTask implements ExtensionPoint {
-
- protected final Logger logger = Logger.getLogger(getClass().getName());
-
+
+ protected final Logger logger = Logger.getLogger(getClass().getName());
+
/**
* Gets the number of milliseconds between successive executions.
*
*
- * Jenkins calls this method every time the timer task is scheduled.
+ * Jenkins calls this method every time the timer task is scheduled.
*
*/
public abstract long getRecurrencePeriod();
/**
- * Gets new instance of task to be executed. Method should return new instance each time, as there no check, if previously
+ * Gets new instance of task to be executed. Method should return new instance each time, as there no check, if previously
* scheduled task already finished. Returning same instance could lead to throwing {@link IllegalStateException} (especially
* in case of {@link AsyncAperiodicWork}) and therefore scheduling of next tasks will be broken.
- *
+ *
* @return AperiodicWork - timer task instance to be executed
*/
public abstract AperiodicWork getNewInstance();
-
+
/**
* Gets the number of milliseconds till the first execution.
*
@@ -88,7 +88,7 @@ public long getInitialDelay() {
@Override
public final void doRun() throws Exception{
- doAperiodicRun();
+ doAperiodicRun();
Timer.get().schedule(getNewInstance(), getRecurrencePeriod(), TimeUnit.MILLISECONDS);
}
@@ -107,7 +107,7 @@ private static void scheduleAperiodWork(AperiodicWork ap) {
}
protected abstract void doAperiodicRun();
-
+
/**
* Returns all the registered {@link AperiodicWork}s.
*/
diff --git a/core/src/main/java/hudson/model/Build.java b/core/src/main/java/hudson/model/Build.java
index 1e82fc04618a..7daa7b4cf0b0 100644
--- a/core/src/main/java/hudson/model/Build.java
+++ b/core/src/main/java/hudson/model/Build.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt
- *
+ *
* 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
@@ -78,7 +78,7 @@
*
*
* And beyond that, the build is considered complete, and from then on {@link Build} object is there to
- * keep the record of what happened in this build.
+ * keep the record of what happened in this build.
*
* @author Kohsuke Kawaguchi
*/
@@ -148,7 +148,7 @@ protected Result doRun(@NonNull BuildListener listener) throws Exception {
Result r = null;
try {
List wrappers = new ArrayList<>(project.getBuildWrappers().values());
-
+
ParametersAction parameters = getAction(ParametersAction.class);
if (parameters != null)
parameters.createBuildWrappers(Build.this,wrappers);
@@ -199,7 +199,7 @@ private boolean build(@NonNull BuildListener listener, @NonNull Collection
* This can be implemented by {@link Action}s that associate themselves
- * with {@link Run}.
+ * with {@link Run}.
*
*
* Actions with this marker should have a view {@code badge.jelly},
diff --git a/core/src/main/java/hudson/model/ComputerSet.java b/core/src/main/java/hudson/model/ComputerSet.java
index db4292989e49..770e25814c3e 100644
--- a/core/src/main/java/hudson/model/ComputerSet.java
+++ b/core/src/main/java/hudson/model/ComputerSet.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly, Thomas J. Black
- *
+ *
* 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
@@ -227,7 +227,7 @@ public void do_launchAll(StaplerRequest req, StaplerResponse rsp) throws IOExcep
@RequirePOST
public void doUpdateNow( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.MANAGE);
-
+
for (NodeMonitor nodeMonitor : NodeMonitor.getAll()) {
Thread t = nodeMonitor.triggerUpdate();
String columnCaption = nodeMonitor.getColumnCaption();
@@ -298,7 +298,7 @@ public synchronized void doDoCreateItem( StaplerRequest req, StaplerResponse rsp
JSONObject formData = req.getSubmittedForm();
formData.put("name", fixedName);
-
+
// TODO type is probably NodeDescriptor.id but confirm
Node result = NodeDescriptor.all().find(type).newInstance(req, formData);
app.addNode(result);
@@ -333,7 +333,7 @@ public FormValidation doCheckName(@QueryParameter String value) throws IOExcepti
if(Util.fixEmpty(value)==null)
return FormValidation.ok();
-
+
try {
checkName(value);
return FormValidation.ok();
@@ -341,7 +341,7 @@ public FormValidation doCheckName(@QueryParameter String value) throws IOExcepti
return FormValidation.error(e.getMessage());
}
}
-
+
/**
* Accepts submission from the configuration page.
*/
diff --git a/core/src/main/java/hudson/model/Describable.java b/core/src/main/java/hudson/model/Describable.java
index ae8103b3cfd9..e1331510d7e1 100644
--- a/core/src/main/java/hudson/model/Describable.java
+++ b/core/src/main/java/hudson/model/Describable.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/model/Descriptor.java b/core/src/main/java/hudson/model/Descriptor.java
index 5b94ff25b1b4..b1066e7428e3 100644
--- a/core/src/main/java/hudson/model/Descriptor.java
+++ b/core/src/main/java/hudson/model/Descriptor.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2011, 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
@@ -136,7 +136,7 @@
* {@link Descriptor} defines addition to the standard Java reflection
* and provides reflective information about its corresponding {@link Describable}.
* These are primarily used by tag libraries to
- * keep the Jelly scripts concise.
+ * keep the Jelly scripts concise.
*
* @author Kohsuke Kawaguchi
* @see Describable
@@ -241,7 +241,7 @@ public List extends Descriptor> getApplicableItemDescriptors() {
/**
* Help file redirect, keyed by the field name to the path.
*
- * @see #getHelpFile(String)
+ * @see #getHelpFile(String)
*/
private final transient Map helpRedirect = new HashMap<>(2);
@@ -279,7 +279,7 @@ protected Descriptor(Class extends T> clazz) {
* Infers the type of the corresponding {@link Describable} from the outer class.
* This version works when you follow the common convention, where a descriptor
* is written as the static nested class of the describable class.
- *
+ *
* @since 1.278
*/
protected Descriptor() {
@@ -335,7 +335,7 @@ public String getDisplayName() {
*
* @return
* Stick to valid Java identifier character, plus '.', which had to be allowed for historical reasons.
- *
+ *
* @since 1.391
*/
public String getId() {
@@ -537,7 +537,7 @@ public final String getJsonSafeClassName() {
/**
* @deprecated
* Implement {@link #newInstance(StaplerRequest, JSONObject)} method instead.
- * Deprecated as of 1.145.
+ * Deprecated as of 1.145.
*/
@Deprecated
public T newInstance(StaplerRequest req) throws FormException {
@@ -769,7 +769,7 @@ public String getHelpFile(Klass> clazz, String fieldName) {
}
return null;
}
-
+
/**
* Tells Jenkins that the help file for the field 'fieldName' is defined in the help file for
* the 'fieldNameToRedirectTo' in the 'owner' class.
diff --git a/core/src/main/java/hudson/model/Executor.java b/core/src/main/java/hudson/model/Executor.java
index cf00f7be5665..f719b65c52eb 100644
--- a/core/src/main/java/hudson/model/Executor.java
+++ b/core/src/main/java/hudson/model/Executor.java
@@ -248,7 +248,7 @@ public Result abortResult() {
// this method is almost always called as a result of the current thread being interrupted
// as a result we need to clean the interrupt flag so that the lock's lock method doesn't
// get confused and think it was interrupted while awaiting the lock
- Thread.interrupted();
+ Thread.interrupted();
// we need to use a write lock as we may be repeatedly interrupted while processing and
// we need the same lock as used in void interrupt(Result,boolean,CauseOfInterruption...)
// JENKINS-28690
@@ -539,12 +539,12 @@ public Queue.Executable getCurrentExecutableForApi() {
Executable candidate = getCurrentExecutable();
return candidate instanceof AccessControlled && ((AccessControlled) candidate).hasPermission(Item.READ) ? candidate : null;
}
-
+
/**
* Returns causes of interruption.
*
* @return Unmodifiable collection of causes of interruption.
- * @since 1.617
+ * @since 1.617
*/
public @NonNull Collection getCausesOfInterruption() {
return Collections.unmodifiableCollection(causes);
diff --git a/core/src/main/java/hudson/model/Fingerprint.java b/core/src/main/java/hudson/model/Fingerprint.java
index 19c8a17feced..fbdb97f7722a 100644
--- a/core/src/main/java/hudson/model/Fingerprint.java
+++ b/core/src/main/java/hudson/model/Fingerprint.java
@@ -1277,7 +1277,7 @@ public synchronized void save() throws IOException {
/**
* Save the Fingerprint in the given file locally
* @throws IOException Save error
- * @deprecated as of TODO. Use {@link #save()} instead.
+ * @deprecated as of 2.242. Use {@link #save()} instead.
*/
@Deprecated
void save(File file) throws IOException {
@@ -1368,7 +1368,7 @@ public Api getApi() {
/**
* Determines the file name from md5sum.
- * @deprecated as of TODO. Use {@link #load(String)} instead.
+ * @deprecated as of 2.242. Use {@link #load(String)} instead.
*/
@Deprecated
/*package*/ static @CheckForNull Fingerprint load(@NonNull byte[] md5sum) throws IOException {
@@ -1379,7 +1379,7 @@ public Api getApi() {
* Loads a {@link Fingerprint} from a file in the image.
* @return Loaded {@link Fingerprint}. Null if the config file does not exist or
* malformed.
- * @deprecated as of TODO. Use {@link #load(String)} instead.
+ * @deprecated as of 2.242. Use {@link #load(String)} instead.
*/
@Deprecated
/*package*/ static @CheckForNull Fingerprint load(@NonNull File file) throws IOException {
diff --git a/core/src/main/java/hudson/model/HealthReportingAction.java b/core/src/main/java/hudson/model/HealthReportingAction.java
index 024c9488725f..c5fa8f0e8894 100644
--- a/core/src/main/java/hudson/model/HealthReportingAction.java
+++ b/core/src/main/java/hudson/model/HealthReportingAction.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly
- *
+ *
* 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
@@ -42,7 +42,7 @@ public interface HealthReportingAction extends Action {
* Get this {@link Action}'s {@link HealthReport}.
*
* @return
- * The health report for this instance of the Action or
+ * The health report for this instance of the Action or
* {@code null} if the Action does not want to
* contribute a HealthReport.
*/
diff --git a/core/src/main/java/hudson/model/InvisibleAction.java b/core/src/main/java/hudson/model/InvisibleAction.java
index bb8c3b14ebe9..d921cd12f8d9 100644
--- a/core/src/main/java/hudson/model/InvisibleAction.java
+++ b/core/src/main/java/hudson/model/InvisibleAction.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -31,7 +31,7 @@
* {@link Action} for just storing data associated with a build.
*
*
- * It could also be used to reduce the amount of code required to just create an accessible url for tests
+ * It could also be used to reduce the amount of code required to just create an accessible url for tests
* by overriding the {@link #getUrlName()} method.
*
* @author Kohsuke Kawaguchi
diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java
index 1e0d90c8ca1e..2658ce50c20f 100644
--- a/core/src/main/java/hudson/model/Job.java
+++ b/core/src/main/java/hudson/model/Job.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt, Matthew R. Harrah, Red Hat, Inc., Stephen Connolly, Tom Huybrechts, CloudBees, Inc.
- *
+ *
* 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
@@ -123,7 +123,7 @@
/**
* A job is an runnable entity under the monitoring of Hudson.
- *
+ *
*
* Every time it "runs", it will be recorded as a {@link Run} object.
*
@@ -132,7 +132,6 @@
*
* @author Kohsuke Kawaguchi
*/
-@SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "TODO needs triage")
public abstract class Job, RunT extends Run>
extends AbstractItem implements ExtensionPoint, StaplerOverridable, ModelObjectWithChildren {
@@ -305,14 +304,14 @@ public boolean isBuilding() {
RunT b = getLastBuild();
return b!=null && b.isBuilding();
}
-
+
/**
* Returns true if the log file is still being updated.
*/
public boolean isLogUpdated() {
RunT b = getLastBuild();
return b!=null && b.isLogUpdated();
- }
+ }
@Override
public String getPronoun() {
@@ -383,7 +382,7 @@ public EnvVars getCharacteristicEnvVars() {
if (node != null) {
final Computer computer = node.toComputer();
if (computer != null) {
- // we need to get computer environment to inherit platform details
+ // we need to get computer environment to inherit platform details
env = computer.getEnvironment();
env.putAll(computer.buildEnvironment(listener));
}
@@ -406,12 +405,12 @@ public EnvVars getCharacteristicEnvVars() {
/**
* Programmatically updates the next build number.
- *
+ *
*
* Much of Hudson assumes that the build number is unique and monotonic, so
* this method can only accept a new value that's bigger than
* {@link #getLastBuild()} returns. Otherwise it'll be no-op.
- *
+ *
* @since 1.199 (before that, this method was package private.)
*/
public synchronized void updateNextBuildNumber(int next) throws IOException {
@@ -510,7 +509,7 @@ public Collection extends Job> getAllJobs() {
/**
* Adds {@link JobProperty}.
- *
+ *
* @since 1.188
*/
public void addProperty(JobProperty super JobT> jobProp) throws IOException {
@@ -726,7 +725,7 @@ public void onLocationChanged(Item item, String oldFullName, String newFullName)
/**
* Gets the read-only view of all the builds.
- *
+ *
* @return never null. The first entry is the latest build.
*/
@Exported(name="allBuilds",visibility=-2)
@@ -818,7 +817,7 @@ public RunT getBuildForCLI(@Argument(required=true,metaVar="BUILD#",usage="Build
/**
* Gets the youngest build #m that satisfies {@code n<=m}.
- *
+ *
* This is useful when you'd like to fetch a build but the exact build might
* be already gone (deleted, rotated, etc.)
* @see LazyBuildMixIn#getNearestBuild
@@ -833,7 +832,7 @@ public RunT getNearestBuild(int n) {
/**
* Gets the latest build #m that satisfies {@code m<=n}.
- *
+ *
* This is useful when you'd like to fetch a build but the exact build might
* be already gone (deleted, rotated, etc.)
* @see LazyBuildMixIn#getNearestOldBuild
@@ -874,7 +873,7 @@ public Object getDynamic(String token, StaplerRequest req,
* Some {@link Job}s may not have backing data store for {@link Run}s, but
* those {@link Job}s that use file system for storing data should use this
* directory for consistency.
- *
+ *
* @see RunMap
*/
public File getBuildDir() {
@@ -890,7 +889,7 @@ public File getBuildDir() {
/**
* Gets all the runs.
- *
+ *
* The resulting map must be treated immutable (by employing copy-on-write
* semantics.) The map is descending order, with newest builds at the top.
* @see LazyBuildMixIn#_getRuns
@@ -899,7 +898,7 @@ public File getBuildDir() {
/**
* Called from {@link Run} to remove it from this job.
- *
+ *
* The files are deleted already. So all the callee needs to do is to remove
* a reference from this {@link Job}.
* @see LazyBuildMixIn#removeRun
@@ -937,7 +936,7 @@ public RunT getFirstBuild() {
/**
* Returns the last successful build, if any. Otherwise null. A successful build
* would include either {@link Result#SUCCESS} or {@link Result#UNSTABLE}.
- *
+ *
* @see #getLastStableBuild()
*/
@Exported
@@ -993,10 +992,10 @@ public RunT getLastFailedBuild() {
public RunT getLastCompletedBuild() {
return (RunT)Permalink.LAST_COMPLETED_BUILD.resolve(this);
}
-
+
/**
* Returns the last {@code numberOfBuilds} builds with a build result ≥ {@code threshold}
- *
+ *
* @return a list with the builds. May be smaller than 'numberOfBuilds' or even empty
* if not enough builds satisfying the threshold have been found. Never null.
*/
@@ -1004,13 +1003,13 @@ public List getLastBuildsOverThreshold(int numberOfBuilds, Result threshol
RunT r = getLastBuild();
return r.getBuildsOverThreshold(numberOfBuilds, threshold);
}
-
+
/**
* Returns candidate build for calculating the estimated duration of the current run.
- *
+ *
* Returns the 3 last successful (stable or unstable) builds, if there are any.
* Failing to find 3 of those, it will return up to 3 last unsuccessful builds.
- *
+ *
* In any case it will not go more than 6 builds into the past to avoid costly build loading.
*/
protected List getEstimatedDurationCandidates() {
@@ -1037,20 +1036,20 @@ protected List getEstimatedDurationCandidates() {
i++;
r = r.getPreviousBuild();
}
-
+
while (candidates.size() < 3) {
if (fallbackCandidates.isEmpty())
break;
RunT run = fallbackCandidates.remove(0);
candidates.add(run);
}
-
+
return candidates;
}
-
+
public long getEstimatedDuration() {
List builds = getEstimatedDurationCandidates();
-
+
if(builds.isEmpty()) return -1;
long totalDuration = 0;
@@ -1188,7 +1187,7 @@ public BallColor getIconColor() {
/**
* Get the current health report for a job.
- *
+ *
* @return the health report. Never returns null
*/
public HealthReport getBuildHealth() {
@@ -1410,65 +1409,91 @@ public String getBuildStatusIconClassName() {
return getIconColor().getIconClassName();
}
- public Graph getBuildTimeGraph() {
- return new Graph(getLastBuildTime(),500,400) {
- @Override
- protected JFreeChart createGraph() {
- class ChartLabel implements Comparable {
- final Run run;
+ private static class ChartLabel implements Comparable {
+ final Run run;
- ChartLabel(Run r) {
- this.run = r;
- }
+ ChartLabel(Run r) {
+ this.run = r;
+ }
- @Override
- public int compareTo(ChartLabel that) {
- return this.run.number - that.run.number;
- }
+ @Override
+ public int compareTo(ChartLabel that) {
+ return this.run.number - that.run.number;
+ }
- @Override
- public boolean equals(Object o) {
- // JENKINS-2682 workaround for Eclipse compilation bug
- // on (c instanceof ChartLabel)
- if (o == null || !ChartLabel.class.isAssignableFrom( o.getClass() )) {
- return false;
- }
- ChartLabel that = (ChartLabel) o;
- return run == that.run;
- }
+ @Override
+ public boolean equals(Object o) {
+ // JENKINS-2682 workaround for Eclipse compilation bug
+ // on (c instanceof ChartLabel)
+ if (o == null || !ChartLabel.class.isAssignableFrom( o.getClass() )) {
+ return false;
+ }
+ ChartLabel that = (ChartLabel) o;
+ return run == that.run;
+ }
- public Color getColor() {
- // TODO: consider gradation. See
- // http://www.javadrive.jp/java2d/shape/index9.html
- Result r = run.getResult();
- if (r == Result.FAILURE)
- return ColorPalette.RED;
- else if (r == Result.UNSTABLE)
- return ColorPalette.YELLOW;
- else if (r == Result.ABORTED || r == Result.NOT_BUILT)
- return ColorPalette.GREY;
- else
- return ColorPalette.BLUE;
- }
+ public Color getColor() {
+ // TODO: consider gradation. See
+ // http://www.javadrive.jp/java2d/shape/index9.html
+ Result r = run.getResult();
+ if (r == Result.FAILURE)
+ return ColorPalette.RED;
+ else if (r == Result.UNSTABLE)
+ return ColorPalette.YELLOW;
+ else if (r == Result.ABORTED || r == Result.NOT_BUILT)
+ return ColorPalette.GREY;
+ else
+ return ColorPalette.BLUE;
+ }
- @Override
- public int hashCode() {
- return run.hashCode();
- }
+ @Override
+ public int hashCode() {
+ return run.hashCode();
+ }
- @Override
- public String toString() {
- String l = run.getDisplayName();
- if (run instanceof Build) {
- String s = ((Build) run).getBuiltOnStr();
- if (s != null)
- l += ' ' + s;
- }
- return l;
- }
+ @Override
+ public String toString() {
+ String l = run.getDisplayName();
+ if (run instanceof Build) {
+ String s = ((Build) run).getBuiltOnStr();
+ if (s != null)
+ l += ' ' + s;
+ }
+ return l;
+ }
+ }
- }
+ @SuppressFBWarnings(value = "EQ_DOESNT_OVERRIDE_EQUALS", justification = "category dataset is only relevant for coloring, not equality")
+ private static class ChartLabelStackedAreaRenderer2 extends StackedAreaRenderer2 {
+ private final CategoryDataset categoryDataset;
+
+ ChartLabelStackedAreaRenderer2(CategoryDataset categoryDataset) {
+ this.categoryDataset = categoryDataset;
+ }
+ @Override
+ public Paint getItemPaint(int row, int column) {
+ ChartLabel key = (ChartLabel) categoryDataset.getColumnKey(column);
+ return key.getColor();
+ }
+
+ @Override
+ public String generateURL(CategoryDataset dataset, int row, int column) {
+ ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
+ return String.valueOf(label.run.number);
+ }
+
+ @Override
+ public String generateToolTip(CategoryDataset dataset, int row, int column) {
+ ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
+ return label.run.getDisplayName() + " : " + label.run.getDurationString();
+ }
+ }
+
+ public Graph getBuildTimeGraph() {
+ return new Graph(getLastBuildTime(), 500, 400) {
+ @Override
+ protected JFreeChart createGraph() {
DataSetBuilder data = new DataSetBuilder<>();
for (Run r : getNewBuilds()) {
if (r.isBuilding())
@@ -1512,28 +1537,7 @@ public String toString() {
ChartUtil.adjustChebyshev(dataset, rangeAxis);
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
- StackedAreaRenderer ar = new StackedAreaRenderer2() {
- @Override
- public Paint getItemPaint(int row, int column) {
- ChartLabel key = (ChartLabel) dataset.getColumnKey(column);
- return key.getColor();
- }
-
- @Override
- public String generateURL(CategoryDataset dataset, int row,
- int column) {
- ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
- return String.valueOf(label.run.number);
- }
-
- @Override
- public String generateToolTip(CategoryDataset dataset, int row,
- int column) {
- ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
- return label.run.getDisplayName() + " : "
- + label.run.getDurationString();
- }
- };
+ StackedAreaRenderer ar = new ChartLabelStackedAreaRenderer2(dataset);
plot.setRenderer(ar);
// crop extra space around the graph
diff --git a/core/src/main/java/hudson/model/NoFingerprintMatch.java b/core/src/main/java/hudson/model/NoFingerprintMatch.java
index 341773677600..d9063ab7401f 100644
--- a/core/src/main/java/hudson/model/NoFingerprintMatch.java
+++ b/core/src/main/java/hudson/model/NoFingerprintMatch.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/model/PaneStatusProperties.java b/core/src/main/java/hudson/model/PaneStatusProperties.java
index cad86b6e743a..29a460349440 100644
--- a/core/src/main/java/hudson/model/PaneStatusProperties.java
+++ b/core/src/main/java/hudson/model/PaneStatusProperties.java
@@ -10,84 +10,84 @@
import org.kohsuke.stapler.Stapler;
public class PaneStatusProperties extends UserProperty implements Saveable {
-
- private final PersistedList collapsed = new PersistedList<>(this);
-
- private static final PaneStatusProperties FALLBACK = new PaneStatusPropertiesSessionFallback();
-
- public boolean isCollapsed(String paneId) {
- return collapsed.contains(paneId);
- }
-
- /**
- * @param paneId panel name
- * @return the actual state of panel
- */
- public boolean toggleCollapsed(String paneId) {
- if (collapsed.contains(paneId)) {
- collapsed.remove(paneId);
- return false;
- } else {
- collapsed.add(paneId);
- return true;
- }
- }
-
- @Override
- public void save() throws IOException {
+
+ private final PersistedList collapsed = new PersistedList<>(this);
+
+ private static final PaneStatusProperties FALLBACK = new PaneStatusPropertiesSessionFallback();
+
+ public boolean isCollapsed(String paneId) {
+ return collapsed.contains(paneId);
+ }
+
+ /**
+ * @param paneId panel name
+ * @return the actual state of panel
+ */
+ public boolean toggleCollapsed(String paneId) {
+ if (collapsed.contains(paneId)) {
+ collapsed.remove(paneId);
+ return false;
+ } else {
+ collapsed.add(paneId);
+ return true;
+ }
+ }
+
+ @Override
+ public void save() throws IOException {
user.save();
}
-
- private Object readResolve() {
- collapsed.setOwner(this);
- return this;
- }
-
- @Extension @Symbol("paneStatus")
- public static class DescriptorImpl extends UserPropertyDescriptor {
-
- @Override
- public UserProperty newInstance(User user) {
- return new PaneStatusProperties();
- }
-
- @Override
- public boolean isEnabled() {
- return false;
- }
-
- }
-
- private static class PaneStatusPropertiesSessionFallback extends PaneStatusProperties {
-
- private static final String attribute = "jenkins_pane_%s_collapsed";
-
- @Override
- public boolean isCollapsed(String paneId) {
- final HttpSession session = Stapler.getCurrentRequest().getSession();
- return session.getAttribute(format(attribute, paneId)) != null;
- }
-
- @Override
- public boolean toggleCollapsed(String paneId) {
- final HttpSession session = Stapler.getCurrentRequest().getSession();
- final String property = format(attribute, paneId);
- final Object collapsed = session.getAttribute(property);
- if (collapsed == null) {
- session.setAttribute(property, true);
- return true;
- }
- session.removeAttribute(property);
- return false;
- }
- }
-
- public static PaneStatusProperties forCurrentUser() {
- final User current = User.current();
- if (current == null) {
- return FALLBACK;
- }
- return current.getProperty(PaneStatusProperties.class);
- }
+
+ private Object readResolve() {
+ collapsed.setOwner(this);
+ return this;
+ }
+
+ @Extension @Symbol("paneStatus")
+ public static class DescriptorImpl extends UserPropertyDescriptor {
+
+ @Override
+ public UserProperty newInstance(User user) {
+ return new PaneStatusProperties();
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+
+ }
+
+ private static class PaneStatusPropertiesSessionFallback extends PaneStatusProperties {
+
+ private static final String attribute = "jenkins_pane_%s_collapsed";
+
+ @Override
+ public boolean isCollapsed(String paneId) {
+ final HttpSession session = Stapler.getCurrentRequest().getSession();
+ return session.getAttribute(format(attribute, paneId)) != null;
+ }
+
+ @Override
+ public boolean toggleCollapsed(String paneId) {
+ final HttpSession session = Stapler.getCurrentRequest().getSession();
+ final String property = format(attribute, paneId);
+ final Object collapsed = session.getAttribute(property);
+ if (collapsed == null) {
+ session.setAttribute(property, true);
+ return true;
+ }
+ session.removeAttribute(property);
+ return false;
+ }
+ }
+
+ public static PaneStatusProperties forCurrentUser() {
+ final User current = User.current();
+ if (current == null) {
+ return FALLBACK;
+ }
+ return current.getProperty(PaneStatusProperties.class);
+ }
}
diff --git a/core/src/main/java/hudson/model/ParametersDefinitionProperty.java b/core/src/main/java/hudson/model/ParametersDefinitionProperty.java
index f08b067d29fb..7470330c7a01 100644
--- a/core/src/main/java/hudson/model/ParametersDefinitionProperty.java
+++ b/core/src/main/java/hudson/model/ParametersDefinitionProperty.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Jean-Baptiste Quenot, Seiji Sogabe, Tom Huybrechts
- *
+ *
* 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
@@ -142,7 +142,7 @@ public void _doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter Ti
List values = new ArrayList<>();
-
+
JSONObject formData = req.getSubmittedForm();
JSONArray a = JSONArray.fromObject(formData.get("parameter"));
@@ -161,7 +161,7 @@ public void _doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter Ti
}
}
- WaitingItem item = Jenkins.get().getQueue().schedule(
+ WaitingItem item = Jenkins.get().getQueue().schedule(
getJob(), delay.getTimeInSeconds(), new ParametersAction(values), new CauseAction(new Cause.UserIdCause()));
if (item!=null) {
String url = formData.optString("redirectTo");
@@ -182,10 +182,10 @@ public void buildWithParameters(StaplerRequest req, StaplerResponse rsp) throws
public void buildWithParameters(StaplerRequest req, StaplerResponse rsp, @CheckForNull TimeDuration delay) throws IOException, ServletException {
List values = new ArrayList<>();
for (ParameterDefinition d: parameterDefinitions) {
- ParameterValue value = d.createValue(req);
- if (value != null) {
- values.add(value);
- }
+ ParameterValue value = d.createValue(req);
+ if (value != null) {
+ values.add(value);
+ }
}
if (delay==null)
delay=new TimeDuration(TimeUnit.MILLISECONDS.convert(getJob().getQuietPeriod(), TimeUnit.SECONDS));
@@ -193,7 +193,7 @@ public void buildWithParameters(StaplerRequest req, StaplerResponse rsp, @CheckF
ScheduleResult scheduleResult = Jenkins.get().getQueue().schedule2(
getJob(), delay.getTimeInSeconds(), new ParametersAction(values), ParameterizedJobMixIn.getBuildCause(getJob(), req));
Queue.Item item = scheduleResult.getItem();
-
+
if (item != null && !scheduleResult.isCreated()) {
rsp.sendRedirect(SC_SEE_OTHER, req.getContextPath() + '/' + item.getUrl());
return;
diff --git a/core/src/main/java/hudson/model/PeriodicWork.java b/core/src/main/java/hudson/model/PeriodicWork.java
index c2fe69a61b6e..9a4e7279a9df 100644
--- a/core/src/main/java/hudson/model/PeriodicWork.java
+++ b/core/src/main/java/hudson/model/PeriodicWork.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -53,7 +53,7 @@
*
*
* This class is designed to run a short task. Implementations whose periodic work takes a long time
- * to run should extend from {@link AsyncPeriodicWork} instead.
+ * to run should extend from {@link AsyncPeriodicWork} instead.
*
* @author Kohsuke Kawaguchi
* @see AsyncPeriodicWork
diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java
index 82213ec77463..d0dbb990c87c 100644
--- a/core/src/main/java/hudson/model/Queue.java
+++ b/core/src/main/java/hudson/model/Queue.java
@@ -850,7 +850,7 @@ public StubItem[] getDiscoverableItems() {
private List filterDiscoverableItemListBasedOnPermissions(List r, Item t) {
if (t.task instanceof hudson.model.Item) {
hudson.model.Item taskAsItem = (hudson.model.Item) t.task;
- if (!taskAsItem.hasPermission(hudson.model.Item.READ)
+ if (!taskAsItem.hasPermission(hudson.model.Item.READ)
&& taskAsItem.hasPermission(hudson.model.Item.DISCOVER)) {
r.add(new StubItem(new StubTask(t.task)));
}
@@ -947,7 +947,7 @@ public List getPendingItems() {
protected List getBlockedItems() {
return new ArrayList<>(snapshot.blockedProjects);
}
-
+
/**
* Returns the snapshot of all {@link LeftItem}s.
*
@@ -1010,7 +1010,7 @@ public boolean isPending(Task t) {
* @param l Label to be checked. If null, any label will be accepted.
* If you want to count {@link BuildableItem}s without assigned labels,
* use {@link #strictCountBuildableItemsFor(hudson.model.Label)}.
- * @return Number of {@link BuildableItem}s for the specified label.
+ * @return Number of {@link BuildableItem}s for the specified label.
*/
public /* @java.annotation.Nonnegative */ int countBuildableItemsFor(@CheckForNull Label l) {
Snapshot snapshot = this.snapshot;
@@ -1025,7 +1025,7 @@ public boolean isPending(Task t) {
r++;
return r;
}
-
+
/**
* How many {@link BuildableItem}s are assigned for the given label?
*
@@ -1331,7 +1331,7 @@ public static boolean tryWithLock(Runnable runnable) {
}
}
/**
- * Wraps a {@link Runnable} with the {@link Queue} lock held.
+ * Wraps a {@link Runnable} with the {@link Queue} lock held.
*
* @param runnable the operation to wrap.
* @since 1.618
@@ -1344,7 +1344,7 @@ public static Runnable wrapWithLock(Runnable runnable) {
}
/**
- * Wraps a {@link hudson.remoting.Callable} with the {@link Queue} lock held.
+ * Wraps a {@link hudson.remoting.Callable} with the {@link Queue} lock held.
*
* @param callable the operation to wrap.
* @since 1.618
@@ -1357,7 +1357,7 @@ public static hudson.remoting.Callable wrapWithLo
}
/**
- * Wraps a {@link java.util.concurrent.Callable} with the {@link Queue} lock held.
+ * Wraps a {@link java.util.concurrent.Callable} with the {@link Queue} lock held.
*
* @param callable the operation to wrap.
* @since 1.618
@@ -1593,10 +1593,10 @@ public void maintain() {
LOGGER.log(Level.WARNING, "s.sortBuildableItems() threw Throwable: {0}", e);
}
}
-
+
// Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871
updateSnapshot();
-
+
// allocate buildable jobs to executors
for (BuildableItem p : new ArrayList<>(
buildables)) {// copy as we'll mutate the list in the loop
@@ -2217,7 +2217,7 @@ public Label getAssignedLabel() {
* Test if the specified {@link SubTask} needs to be run on a node with a particular label.
*
* This method takes {@link LabelAssignmentAction} into account, the first
- * non-null assignment will be returned.
+ * non-null assignment will be returned.
* Otherwise falls back to {@link SubTask#getAssignedLabel()}
* @param st {@link SubTask} to be checked.
* @return Required {@link Label}. Otherwise null, indicating it can run on anywhere.
@@ -2465,7 +2465,7 @@ public StubItem(StubTask task) {
}
}
-
+
/**
* An optional interface for actions on Queue.Item.
* Lets the action cooperate in queue management.
@@ -2987,7 +2987,7 @@ public String toString() {
return "Queue.Snapshot{waitingList=" + waitingList + ";blockedProjects=" + blockedProjects + ";buildables=" + buildables + ";pendings=" + pendings + "}";
}
}
-
+
private static class LockedRunnable implements Runnable {
private final Runnable delegate;
diff --git a/core/src/main/java/hudson/model/ResourceActivity.java b/core/src/main/java/hudson/model/ResourceActivity.java
index 978947d60e97..38511a7bd7ae 100644
--- a/core/src/main/java/hudson/model/ResourceActivity.java
+++ b/core/src/main/java/hudson/model/ResourceActivity.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -41,12 +41,12 @@ public interface ResourceActivity {
* If the activity doesn't lock any resources, just
* return {@link ResourceList#EMPTY} (or decline to override).
*
- * @return never null
+ * @return never null
*/
default ResourceList getResourceList() {
return ResourceList.EMPTY;
}
-
+
/**
* Used for rendering HTML.
*/
diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java
index acb4455cb3c3..fa8500367c71 100644
--- a/core/src/main/java/hudson/model/Run.java
+++ b/core/src/main/java/hudson/model/Run.java
@@ -1,22 +1,22 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2012, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Daniel Dyer, Red Hat, Inc., Tom Huybrechts, Romain Seguy, Yahoo! Inc.,
* Darek Ostolski, CloudBees, Inc.
* Copyright (c) 2012, Martin Schroeder, Intel Mobile Communications GmbH
* Copyright (c) 2019 Intel Corporation
- *
+ *
* 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
@@ -211,7 +211,7 @@ public abstract class Run ,RunT extends Run T getCause(Class type) {
for (Cause c : getCauses())
if (type.isInstance(c))
@@ -628,7 +628,7 @@ public final boolean isKeepLog() {
/**
* If {@link #isKeepLog()} returns true, returns a short, human-readable
* sentence that explains why it's being kept.
- */
+ */
public @CheckForNull String getWhyKeepLog() {
if(keepLog)
return Messages.Run_MarkedExplicitly();
@@ -637,7 +637,7 @@ public final boolean isKeepLog() {
/**
* The project this build is for.
- */
+ */
public @NonNull JobT getParent() {
return project;
}
@@ -646,7 +646,7 @@ public final boolean isKeepLog() {
* When the build is scheduled.
*
* @see #getStartTimeInMillis()
- */
+ */
@Exported
public @NonNull Calendar getTimestamp() {
GregorianCalendar c = new GregorianCalendar();
@@ -656,7 +656,7 @@ public final boolean isKeepLog() {
/**
* Same as {@link #getTimestamp()} but in a different type.
- */
+ */
public final @NonNull Date getTime() {
return new Date(timestamp);
}
@@ -744,9 +744,9 @@ public String getDescription() {
if (displayChars >= maxDescrLength) {
truncDesc = truncDesc.substring(0, lastTruncatablePoint) + ending;
}
-
+
return truncDesc;
-
+
}
/**
@@ -859,7 +859,7 @@ public int getNumber() {
* @return Reference to the build. Never null
* @see jenkins.model.lazy.LazyBuildMixIn.RunMixIn#createReference
* @since 1.556
- */
+ */
protected @NonNull BuildReference createReference() {
return new BuildReference<>(getId(), _this());
}
@@ -879,14 +879,14 @@ protected void dropLinks() {
/**
* @see jenkins.model.lazy.LazyBuildMixIn.RunMixIn#getPreviousBuild
- */
+ */
public @CheckForNull RunT getPreviousBuild() {
return previousBuild;
}
/**
* Gets the most recent {@linkplain #isBuilding() completed} build excluding 'this' Run itself.
- */
+ */
public final @CheckForNull RunT getPreviousCompletedBuild() {
RunT r=getPreviousBuild();
while (r!=null && r.isBuilding())
@@ -901,7 +901,7 @@ protected void dropLinks() {
*
* We basically follow the existing skip list, and wherever we find a non-optimal pointer, we remember them
* in 'fixUp' and update them later.
- */
+ */
public final @CheckForNull RunT getPreviousBuildInProgress() {
if(previousBuildInProgress==this) return null; // the most common case
@@ -937,7 +937,7 @@ protected void dropLinks() {
/**
* Returns the last build that was actually built - i.e., skipping any with Result.NOT_BUILT
- */
+ */
public @CheckForNull RunT getPreviousBuiltBuild() {
RunT r=getPreviousBuild();
// in certain situations (aborted m2 builds) r.getResult() can still be null, although it should theoretically never happen
@@ -948,7 +948,7 @@ protected void dropLinks() {
/**
* Returns the last build that didn't fail before this build.
- */
+ */
public @CheckForNull RunT getPreviousNotFailedBuild() {
RunT r=getPreviousBuild();
while( r!=null && r.getResult()==Result.FAILURE )
@@ -958,7 +958,7 @@ protected void dropLinks() {
/**
* Returns the last failed build before this build.
- */
+ */
public @CheckForNull RunT getPreviousFailedBuild() {
RunT r=getPreviousBuild();
while( r!=null && r.getResult()!=Result.FAILURE )
@@ -979,14 +979,14 @@ protected void dropLinks() {
/**
* Returns the last {@code numberOfBuilds} builds with a build result ≥ {@code threshold}.
- *
+ *
* @param numberOfBuilds the desired number of builds
* @param threshold the build result threshold
* @return a list with the builds (youngest build first).
* May be smaller than 'numberOfBuilds' or even empty
* if not enough builds satisfying the threshold have been found. Never null.
* @since 1.383
- */
+ */
public @NonNull List getPreviousBuildsOverThreshold(int numberOfBuilds, @NonNull Result threshold) {
RunT r = getPreviousBuild();
if (r != null) {
@@ -1022,7 +1022,7 @@ protected void dropLinks() {
/**
* @see jenkins.model.lazy.LazyBuildMixIn.RunMixIn#getNextBuild
- */
+ */
public @CheckForNull RunT getNextBuild() {
return nextBuild;
}
@@ -1031,7 +1031,7 @@ protected void dropLinks() {
* Returns the URL of this {@link Run}, relative to the context root of Hudson.
*
* @return
- * String like "job/foo/32/" with trailing slash but no leading slash.
+ * String like "job/foo/32/" with trailing slash but no leading slash.
*/
// I really messed this up. I'm hoping to fix this some time
// it shouldn't have trailing '/', and instead it should have leading '/'
@@ -1079,7 +1079,7 @@ protected void dropLinks() {
public @NonNull String getId() {
return id != null ? id : Integer.toString(number);
}
-
+
/**
* Get the root directory of this {@link Run} on the controller.
* Files related to this {@link Run} should be stored below this directory.
@@ -1144,8 +1144,8 @@ public File getArtifactsDir() {
/**
* Gets the artifacts (relative to {@link #getArtifactsDir()}.
* @return The list can be empty but never null
- */
- @Exported
+ */
+ @Exported
public @NonNull List getArtifacts() {
return getArtifactsUpTo(Integer.MAX_VALUE);
}
@@ -1153,7 +1153,7 @@ public File getArtifactsDir() {
/**
* Gets the first N artifacts.
* @return The list can be empty but never null
- */
+ */
public @NonNull List getArtifactsUpTo(int artifactsNumber) {
SerializableArtifactList sal;
VirtualFile root = getArtifactManager().root();
@@ -1195,7 +1195,7 @@ public SerializableArtifactList call() throws IOException {
}
private static int addArtifacts(@NonNull VirtualFile dir,
- @NonNull String path, @NonNull String pathHref,
+ @NonNull String path, @NonNull String pathHref,
@NonNull SerializableArtifactList r, @CheckForNull SerializableArtifact parent, int upTo) throws IOException {
VirtualFile[] kids = dir.list();
Arrays.sort(kids);
@@ -1232,7 +1232,7 @@ private static int addArtifacts(@NonNull VirtualFile dir,
}
return n;
}
-
+
/**
* Maximum number of artifacts to list before using switching to the tree view.
*/
@@ -1244,7 +1244,7 @@ private static int addArtifacts(@NonNull VirtualFile dir,
public static final int TREE_CUTOFF = Integer.parseInt(SystemProperties.getString("hudson.model.Run.ArtifactList.treeCutoff", "40"));
// ..and then "too many"
-
+
/** {@link Run.Artifact} without the implicit link to {@link Run} */
private static final class SerializableArtifact implements Serializable {
private static final long serialVersionUID = 1L;
@@ -1355,7 +1355,7 @@ public class Artifact {
/**
* Relative path name from artifacts root.
*/
- @Exported(visibility=3)
+ @Exported(visibility=3)
public final String relativePath;
/**
@@ -1410,12 +1410,12 @@ public class Artifact {
/**
* Returns just the file name portion, without the path.
*/
- @Exported(visibility=3)
+ @Exported(visibility=3)
public String getFileName() {
return name;
}
- @Exported(visibility=3)
+ @Exported(visibility=3)
public String getDisplayPath() {
return displayPath;
}
@@ -1427,7 +1427,7 @@ public String getHref() {
public String getLength() {
return length;
}
-
+
public long getFileSize(){
try {
return Long.decode(length);
@@ -1462,7 +1462,7 @@ public Collection getBuildFingerprints() {
}
return Collections.emptyList();
}
-
+
/**
* Returns the log file.
* @return The file may reference both uncompressed or compressed logs
@@ -1487,15 +1487,15 @@ public Collection getBuildFingerprints() {
* Returns an input stream that reads from the log file.
* It will use a gzip-compressed log file (log.gz) if that exists.
*
- * @return An input stream from the log file.
+ * @return An input stream from the log file.
* If the log file does not exist, the error message will be returned to the output.
* @since 1.349
*/
public @NonNull InputStream getLogInputStream() throws IOException {
- File logFile = getLogFile();
-
- if (logFile.exists() ) {
- // Checking if a ".gz" file was return
+ File logFile = getLogFile();
+
+ if (logFile.exists() ) {
+ // Checking if a ".gz" file was return
try {
InputStream fis = Files.newInputStream(logFile.toPath());
if (logFile.getName().endsWith(".gz")) {
@@ -1506,12 +1506,12 @@ public Collection getBuildFingerprints() {
} catch (InvalidPathException e) {
throw new IOException(e);
}
- }
-
+ }
+
String message = "No such file: " + logFile;
- return new ByteArrayInputStream(charset != null ? message.getBytes(charset) : message.getBytes(Charset.defaultCharset()));
+ return new ByteArrayInputStream(charset != null ? message.getBytes(charset) : message.getBytes(Charset.defaultCharset()));
}
-
+
public @NonNull Reader getLogReader() throws IOException {
if (charset==null) return new InputStreamReader(getLogInputStream(),Charset.defaultCharset());
else return new InputStreamReader(getLogInputStream(),charset);
@@ -1565,7 +1565,7 @@ public void writeWholeLogTo(@NonNull OutputStream out) throws IOException, Inter
/**
* Used to URL-bind {@link AnnotatedLargeText}.
* @return A {@link Run} log with annotations
- */
+ */
public @NonNull AnnotatedLargeText getLogText() {
return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
}
@@ -1593,7 +1593,7 @@ public ACL getACL() {
}
/**
- * Deletes this build's artifacts.
+ * Deletes this build's artifacts.
*
* @throws IOException
* if we fail to delete.
@@ -1639,17 +1639,17 @@ public void delete() throws IOException {
}
return;
}
-
+
//The root dir exists and is a directory that needs to be purged
RunListener.fireDeleted(this);
-
+
if (artifactManager != null) {
deleteArtifacts();
} // for StandardArtifactManager, deleting the whole build dir suffices
-
+
synchronized (this) { // avoid holding a lock while calling plugin impls of onDeleted
File tmp = new File(rootDir.getParentFile(),'.'+rootDir.getName());
-
+
if (tmp.exists()) {
Util.deleteRecursive(tmp);
}
@@ -1662,7 +1662,7 @@ public void delete() throws IOException {
} catch (UnsupportedOperationException | SecurityException ex) {
throw new IOException(rootDir + " is in use", ex);
}
-
+
Util.deleteRecursive(tmp);
// some user reported that they see some left-over .xyz files in the workspace,
// so just to make sure we've really deleted it, schedule the deletion on VM exit, too.
@@ -1728,7 +1728,7 @@ protected abstract class Runner extends RunExecution {}
*/
public abstract class RunExecution {
/**
- * Keeps track of the check points attained by a build, and abstracts away the synchronization needed to
+ * Keeps track of the check points attained by a build, and abstracts away the synchronization needed to
* maintain this data structure.
*/
private final class CheckpointSet {
@@ -2201,9 +2201,9 @@ public abstract static class StatusSummarizer implements ExtensionPoint {
if (isBuilding()) {
return new Summary(false, Messages.Run_Summary_Unknown());
}
-
+
ResultTrend trend = ResultTrend.getResultTrend(this);
-
+
for (StatusSummarizer summarizer : ExtensionList.lookup(StatusSummarizer.class)) {
Summary summary = summarizer.summarize(this, trend);
if (summary != null) {
@@ -2213,30 +2213,30 @@ public abstract static class StatusSummarizer implements ExtensionPoint {
switch (trend) {
case ABORTED : return new Summary(false, Messages.Run_Summary_Aborted());
-
+
case NOT_BUILT : return new Summary(false, Messages.Run_Summary_NotBuilt());
-
+
case FAILURE : return new Summary(true, Messages.Run_Summary_BrokenSinceThisBuild());
-
- case STILL_FAILING :
+
+ case STILL_FAILING :
RunT since = getPreviousNotFailedBuild();
if(since==null)
return new Summary(false, Messages.Run_Summary_BrokenForALongTime());
RunT failedBuild = since.getNextBuild();
return new Summary(false, Messages.Run_Summary_BrokenSince(failedBuild.getDisplayName()));
-
+
case NOW_UNSTABLE:
case STILL_UNSTABLE :
return new Summary(false, Messages.Run_Summary_Unstable());
case UNSTABLE :
return new Summary(true, Messages.Run_Summary_Unstable());
-
+
case SUCCESS :
return new Summary(false, Messages.Run_Summary_Stable());
-
+
case FIXED :
return new Summary(false, Messages.Run_Summary_BackToNormal());
-
+
default:
return new Summary(false, Messages.Run_Summary_Unknown());
}
@@ -2356,7 +2356,7 @@ public void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOExcep
}
catch(IOException ex){
req.setAttribute("stackTraces", Functions.printThrowable(ex));
- req.getView(this, "delete-retry.jelly").forward(req, rsp);
+ req.getView(this, "delete-retry.jelly").forward(req, rsp);
return;
}
rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
@@ -2367,7 +2367,7 @@ public void setDescription(String description) throws IOException {
this.description = description;
save();
}
-
+
/**
* Accepts the new description.
*/
@@ -2412,7 +2412,7 @@ public EnvVars getEnvironment() throws IOException, InterruptedException {
*
* Unlike earlier {@link #getEnvVars()}, this map contains the whole environment,
* not just the overrides, so one can introspect values to change its behavior.
- *
+ *
* @return the map with the environmental variables.
* @since 1.305
*/
@@ -2491,7 +2491,7 @@ public EnvVars getEnvironment() throws IOException, InterruptedException {
* Returns the estimated duration for this run if it is currently running.
* Default to {@link Job#getEstimatedDuration()}, may be overridden in subclasses
* if duration may depend on run specific parameters (like incremental Maven builds).
- *
+ *
* @return the estimated duration in milliseconds
* @since 1.383
*/
@@ -2531,7 +2531,7 @@ protected void submit(JSONObject json) throws IOException {
private static final Logger LOGGER = Logger.getLogger(Run.class.getName());
/**
- * Sort by date. Newer ones first.
+ * Sort by date. Newer ones first.
*/
public static final Comparator ORDER_BY_DATE = new Comparator() {
@Override
diff --git a/core/src/main/java/hudson/model/RunMap.java b/core/src/main/java/hudson/model/RunMap.java
index 451fd577f584..88f8da4f8127 100644
--- a/core/src/main/java/hudson/model/RunMap.java
+++ b/core/src/main/java/hudson/model/RunMap.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts
- *
+ *
* 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
diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java
index 56b45ca4debf..2a9302b9081e 100644
--- a/core/src/main/java/hudson/model/UpdateCenter.java
+++ b/core/src/main/java/hudson/model/UpdateCenter.java
@@ -142,13 +142,13 @@
*
* Extending Update Centers. The update center in {@code Jenkins} can be replaced by defining a
* System Property ({@code hudson.model.UpdateCenter.className}). See {@link #createUpdateCenter(hudson.model.UpdateCenter.UpdateCenterConfiguration)}.
- * This className should be available on early startup, so it cannot come only from a library
+ * This className should be available on early startup, so it cannot come only from a library
* (e.g. Jenkins module or Extra library dependency in the WAR file project).
* Plugins cannot be used for such purpose.
- * In order to be correctly instantiated, the class definition must have two constructors:
+ * In order to be correctly instantiated, the class definition must have two constructors:
* {@link #UpdateCenter()} and {@link #UpdateCenter(hudson.model.UpdateCenter.UpdateCenterConfiguration)}.
* If the class does not comply with the requirements, a fallback to the default UpdateCenter will be performed.
- *
+ *
* @author Kohsuke Kawaguchi
* @since 1.220
*/
@@ -268,7 +268,7 @@ public UpdateCenter() {
UpdateCenter(@NonNull UpdateCenterConfiguration configuration) {
configure(configuration);
}
-
+
/**
* Creates an update center.
* @param config Requested configuration. May be {@code null} if defaults should be used
@@ -283,7 +283,7 @@ public static UpdateCenter createUpdateCenter(@CheckForNull UpdateCenterConfigur
LOGGER.log(Level.FINE, "Using the default Update Center implementation");
return createDefaultUpdateCenter(config);
}
-
+
LOGGER.log(Level.FINE, "Using the custom update center: {0}", requiredClassName);
try {
final Class> clazz = Class.forName(requiredClassName).asSubclass(UpdateCenter.class);
@@ -308,7 +308,7 @@ public static UpdateCenter createUpdateCenter(@CheckForNull UpdateCenterConfigur
}
return createDefaultUpdateCenter(config);
}
-
+
@NonNull
private static UpdateCenter createDefaultUpdateCenter(@CheckForNull UpdateCenterConfiguration config) {
return config != null ? new UpdateCenter(config) : new UpdateCenter();
@@ -695,9 +695,9 @@ public String getDefaultBaseUrl() {
private boolean checkMinVersion(@CheckForNull Plugin p, @CheckForNull VersionNumber minVersion) {
return p != null
&& (minVersion == null || !minVersion.isNewerThan(new VersionNumber(p.version)));
- }
+ }
- /**
+ /**
* Schedules a Jenkins upgrade.
*/
@RequirePOST
@@ -1663,7 +1663,7 @@ public void run() {
addStatus(e);
error = e;
}
-
+
if(internetCheck != null) {
try {
// Wait for internet check to complete
@@ -1686,7 +1686,7 @@ public String[] getStatuses() {
}
-
+
/**
* Enables a required plugin, provides feedback in the update center
*/
@@ -1694,11 +1694,11 @@ public class EnableJob extends InstallationJob {
public EnableJob(UpdateSite site, Authentication auth, @NonNull Plugin plugin, boolean dynamicLoad) {
super(plugin, site, auth, dynamicLoad);
}
-
+
public Plugin getPlugin() {
return plugin;
}
-
+
@Override
public void run() {
try {
@@ -1712,7 +1712,7 @@ public void run() {
error = e;
status = new DownloadJob.Failure(e);
}
-
+
if (dynamicLoad) {
try {
// remove the existing, disabled inactive plugin to force a new one to load
@@ -1739,7 +1739,7 @@ public void run() {
}
}
}
-
+
/**
* A no-op, e.g. this plugin is already installed
*/
@@ -1760,7 +1760,7 @@ public void run() {
String getComputedSHA256();
String getComputedSHA512();
}
-
+
/**
* Base class for a job that downloads a file from the Jenkins project.
*/
diff --git a/core/src/main/java/hudson/model/UpdateSite.java b/core/src/main/java/hudson/model/UpdateSite.java
index cf56d13bea44..53865761eb16 100644
--- a/core/src/main/java/hudson/model/UpdateSite.java
+++ b/core/src/main/java/hudson/model/UpdateSite.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc., Seiji Sogabe,
* Andrew Bayer
- *
+ *
* 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
@@ -219,7 +219,7 @@ public long getDataTimestamp() {
public @NonNull FormValidation updateDirectlyNow(boolean signatureCheck) throws IOException {
return updateData(DownloadService.loadJSON(new URL(getUrl() + "?id=" + URLEncoder.encode(getId(), "UTF-8") + "&version=" + URLEncoder.encode(Jenkins.VERSION, "UTF-8"))), signatureCheck);
}
-
+
private FormValidation updateData(String json, boolean signatureCheck)
throws IOException {
@@ -314,7 +314,7 @@ public synchronized boolean isDue() {
long now = System.currentTimeMillis();
retryWindow = Math.max(retryWindow,SECONDS.toMillis(15));
-
+
boolean due = now - dataTimestamp > DAY && now - lastAttempt > retryWindow;
if(due) {
lastAttempt = now;
@@ -447,7 +447,7 @@ private TextFile getDataFile() {
return new TextFile(new File(Jenkins.get().getRootDir(),
"updates/" + getId()+".json"));
}
-
+
/**
* Returns the list of plugins that are updates to currently installed ones.
*
@@ -458,16 +458,16 @@ private TextFile getDataFile() {
public List getUpdates() {
Data data = getData();
if(data==null) return Collections.emptyList(); // fail to determine
-
+
List r = new ArrayList<>();
for (PluginWrapper pw : Jenkins.get().getPluginManager().getPlugins()) {
Plugin p = pw.getUpdateInfo();
if(p!=null) r.add(p);
}
-
+
return r;
}
-
+
/**
* Does any of the plugin has updates?
*/
@@ -475,17 +475,17 @@ public List getUpdates() {
public boolean hasUpdates() {
Data data = getData();
if(data==null) return false;
-
+
for (PluginWrapper pw : Jenkins.get().getPluginManager().getPlugins()) {
if(!pw.isBundled() && pw.getUpdateInfo()!=null)
// do not advertize updates to bundled plugins, since we generally want users to get them
- // as a part of jenkins.war updates. This also avoids unnecessary pinning of plugins.
+ // as a part of jenkins.war updates. This also avoids unnecessary pinning of plugins.
return true;
}
return false;
}
-
-
+
+
/**
* Exposed to get rid of hardcoding of the URL that serves up update-center.json
* in JavaScript.
@@ -1164,7 +1164,7 @@ public final class Plugin extends Entry {
*/
@Exported
public final Map dependencies;
-
+
/**
* Optional dependencies of this plugin.
*/
diff --git a/core/src/main/java/hudson/model/UsageStatistics.java b/core/src/main/java/hudson/model/UsageStatistics.java
index a62031bfc406..1b57d7282403 100644
--- a/core/src/main/java/hudson/model/UsageStatistics.java
+++ b/core/src/main/java/hudson/model/UsageStatistics.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, 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
@@ -73,7 +73,7 @@
@Extension
public class UsageStatistics extends PageDecorator implements PersistentDescriptor {
private static final Logger LOG = Logger.getLogger(UsageStatistics.class.getName());
-
+
private final String keyImage;
/**
@@ -103,7 +103,7 @@ public UsageStatistics(String keyImage) {
public boolean isDue() {
// user opted out. no data collection.
if(!Jenkins.get().isUsageStatisticsCollected() || DISABLED) return false;
-
+
long now = System.currentTimeMillis();
if(now - lastAttempt > DAY) {
lastAttempt = now;
@@ -125,7 +125,7 @@ private RSAPublicKey getKey() {
}
/**
- * Gets the encrypted usage stat data to be sent to the Hudson server.
+ * Gets the encrypted usage stat data to be sent to the Hudson server.
* Used exclusively by jelly: resources/hudson/model/UsageStatistics/footer.jelly
*/
public String getStatData() throws IOException {
diff --git a/core/src/main/java/hudson/model/UserPropertyDescriptor.java b/core/src/main/java/hudson/model/UserPropertyDescriptor.java
index 5367c7c01451..a29ab777c880 100644
--- a/core/src/main/java/hudson/model/UserPropertyDescriptor.java
+++ b/core/src/main/java/hudson/model/UserPropertyDescriptor.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer
- *
+ *
* 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
@@ -25,7 +25,7 @@
/**
* {@link Descriptor} for {@link UserProperty}.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public abstract class UserPropertyDescriptor extends Descriptor {
@@ -67,7 +67,7 @@ protected UserPropertyDescriptor() {
*
*
* This mechanism is useful if the availability of the property is
- * contingent of some other settings.
+ * contingent of some other settings.
*/
public boolean isEnabled() {
return true;
diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java
index 9b0160f4de02..b743d91834e4 100644
--- a/core/src/main/java/hudson/model/View.java
+++ b/core/src/main/java/hudson/model/View.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts,
* Yahoo!, Inc.
- *
+ *
* 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
@@ -105,7 +105,6 @@
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
-import org.apache.commons.jelly.JellyContext;
import org.apache.commons.lang.StringUtils;
import org.jenkins.ui.icon.Icon;
import org.jenkins.ui.icon.IconSet;
@@ -139,7 +138,7 @@
*
* {@link View} subtypes need the {@code newViewDetail.jelly} page,
* which is included in the "new view" page. This page should have some
- * description of what the view is about.
+ * description of what the view is about.
*
*
* @author Kohsuke Kawaguchi
@@ -164,7 +163,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
* Message displayed in the view page.
*/
protected String description;
-
+
/**
* If true, only show relevant executors
*/
@@ -174,7 +173,7 @@ public abstract class View extends AbstractModelObject implements AccessControll
* If true, only show relevant queue items
*/
protected boolean filterQueue;
-
+
/**
* List of {@link ViewProperty}s configured for this view.
* @since 1.406
@@ -385,7 +384,7 @@ public String getNewPronoun() {
public boolean isEditable() {
return true;
}
-
+
/**
* Used to enable or disable automatic refreshes of the view.
*
@@ -397,14 +396,14 @@ public boolean isEditable() {
public boolean isAutomaticRefreshEnabled() {
return false;
}
-
+
/**
* If true, only show relevant executors
*/
public boolean isFilterExecutors() {
return filterExecutors;
}
-
+
/**
* If true, only show relevant queue items
*/
@@ -443,7 +442,7 @@ public Indenter getIndenter() {
public boolean isDefault() {
return getOwner().getPrimaryView()==this;
}
-
+
public List getComputers() {
Computer[] computers = Jenkins.get().getComputers();
@@ -958,13 +957,13 @@ public final class People {
void addDisplayNamesToSearchIndex(SearchIndexBuilder sib, Collection items) {
for(TopLevelItem item : items) {
-
+
if(LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.format("Adding url=%s,displayName=%s",
item.getSearchUrl(), item.getDisplayName()));
}
sib.add(item.getSearchUrl(), item.getDisplayName());
- }
+ }
}
/**
@@ -991,7 +990,7 @@ protected String getName(TopLevelItem o) {
public SearchIndexBuilder makeSearchIndex() {
SearchIndexBuilder sib = super.makeSearchIndex();
makeSearchIndex(sib);
-
+
// add the display name for each item in the search index
addDisplayNamesToSearchIndex(sib, getItems());
@@ -1060,7 +1059,7 @@ public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp) thr
*
* This method should call {@link ModifiableItemGroup#doCreateItem(StaplerRequest, StaplerResponse)}
* and then add the newly created item to this view.
- *
+ *
* @return
* null if fails.
*/
@@ -1110,13 +1109,12 @@ public Categories doItemCategories(StaplerRequest req, StaplerResponse rsp, @Que
rsp.addHeader("Expires", "0");
Categories categories = new Categories();
int order = 0;
- JellyContext ctx;
+ String resUrl;
if (StringUtils.isNotBlank(iconStyle)) {
- ctx = new JellyContext();
- ctx.setVariable("resURL", req.getContextPath() + Jenkins.RESOURCE_PATH);
+ resUrl = req.getContextPath() + Jenkins.RESOURCE_PATH;
} else {
- ctx = null;
+ resUrl = null;
}
for (TopLevelItemDescriptor descriptor : DescriptorVisibilityFilter.apply(getOwner().getItemGroup(), Items.all2(Jenkins.getAuthentication2(), getOwner().getItemGroup()))) {
ItemCategory ic = ItemCategory.getCategory(descriptor);
@@ -1131,11 +1129,11 @@ public Categories doItemCategories(StaplerRequest req, StaplerResponse rsp, @Que
String iconClassName = descriptor.getIconClassName();
if (StringUtils.isNotBlank(iconClassName)) {
metadata.put("iconClassName", iconClassName);
- if (ctx != null) {
+ if (resUrl != null) {
Icon icon = IconSet.icons
.getIconByClassSpec(String.join(" ", iconClassName, iconStyle));
if (icon != null) {
- metadata.put("iconQualifiedUrl", icon.getQualifiedUrl(ctx));
+ metadata.put("iconQualifiedUrl", icon.getQualifiedUrl(resUrl));
}
}
}
@@ -1160,11 +1158,11 @@ public void doRssAll( StaplerRequest req, StaplerResponse rsp ) throws IOExcepti
public void doRssFailed( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
RSS.rss(req, rsp, "Jenkins:" + getDisplayName() + " (failed builds)", getUrl(), getBuilds().failureOnly().newBuilds());
}
-
+
public RunList getBuilds() {
return new RunList(this);
}
-
+
public BuildTimelineWidget getTimeline() {
return new BuildTimelineWidget(getBuilds());
}
@@ -1336,7 +1334,7 @@ public static void registerPermissions() {
public static Permission getItemCreatePermission() {
return Item.CREATE;
}
-
+
public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
throws FormException, IOException, ServletException {
String mode = req.getParameter("mode");
diff --git a/core/src/main/java/hudson/model/queue/MappingWorksheet.java b/core/src/main/java/hudson/model/queue/MappingWorksheet.java
index 02492a81f675..f6f5edb35df9 100644
--- a/core/src/main/java/hudson/model/queue/MappingWorksheet.java
+++ b/core/src/main/java/hudson/model/queue/MappingWorksheet.java
@@ -314,7 +314,7 @@ public MappingWorksheet(BuildableItem item, List extends ExecutorSlot> offers)
public MappingWorksheet(BuildableItem item, List extends ExecutorSlot> offers, Collection extends LoadPredictor> loadPredictors) {
this.item = item;
-
+
// group executors by their computers
Map> j = new HashMap<>();
for (ExecutorSlot o : offers) {
diff --git a/core/src/main/java/hudson/os/SU.java b/core/src/main/java/hudson/os/SU.java
index 9103c72a866f..6a373cd53e04 100644
--- a/core/src/main/java/hudson/os/SU.java
+++ b/core/src/main/java/hudson/os/SU.java
@@ -159,7 +159,7 @@ VirtualChannel start(TaskListener listener, String rootPassword) throws IOExcept
ArgumentListBuilder args = new ArgumentListBuilder().add(javaExe);
if(agentJar.isFile())
args.add("-jar").add(agentJar);
- else // in production code this never happens, but during debugging this is convenient
+ else // in production code this never happens, but during debugging this is convenient
args.add("-cp").add(agentJar).add(hudson.remoting.Launcher.class.getName());
if (Util.fixEmptyAndTrim(rootPassword) == null) {
diff --git a/core/src/main/java/hudson/scheduler/CronTab.java b/core/src/main/java/hudson/scheduler/CronTab.java
index c01f74e167aa..9055912cc3ca 100644
--- a/core/src/main/java/hudson/scheduler/CronTab.java
+++ b/core/src/main/java/hudson/scheduler/CronTab.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, InfraDNA, Inc.
- *
+ *
* 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
@@ -62,7 +62,7 @@ public final class CronTab {
private String spec;
/**
- * Optional timezone string for calendar
+ * Optional timezone string for calendar
*/
private @CheckForNull String specTimezone;
@@ -73,7 +73,7 @@ public CronTab(String format) throws ANTLRException {
public CronTab(String format, Hash hash) throws ANTLRException {
this(format,1,hash);
}
-
+
/**
* @deprecated as of 1.448
* Use {@link #CronTab(String, int, Hash)}
@@ -94,14 +94,14 @@ public CronTab(String format, int line, Hash hash) throws ANTLRException {
/**
* @param timezone
- * Used to schedule cron in a different timezone. Null to use the default system
+ * Used to schedule cron in a different timezone. Null to use the default system
* timezone
* @since 1.615
*/
public CronTab(String format, int line, Hash hash, @CheckForNull String timezone) throws ANTLRException {
set(format, line, hash, timezone);
}
-
+
private void set(String format, int line, Hash hash) throws ANTLRException {
set(format, line, hash, null);
}
diff --git a/core/src/main/java/hudson/scm/SCMDescriptor.java b/core/src/main/java/hudson/scm/SCMDescriptor.java
index 7a9465b88e06..f7d61f1f7323 100644
--- a/core/src/main/java/hudson/scm/SCMDescriptor.java
+++ b/core/src/main/java/hudson/scm/SCMDescriptor.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -52,7 +52,7 @@ public abstract class SCMDescriptor extends Descriptor {
* that type. Otherwise this SCM will not have any repository browser.
*/
public final transient Class extends RepositoryBrowser> repositoryBrowser;
-
+
private final transient AtomicInteger atomicGeneration = new AtomicInteger(1);
protected SCMDescriptor(Class clazz, Class extends RepositoryBrowser> repositoryBrowser) {
diff --git a/core/src/main/java/hudson/scm/browsers/QueryBuilder.java b/core/src/main/java/hudson/scm/browsers/QueryBuilder.java
index f80ca8a8068e..04dffed3e15c 100644
--- a/core/src/main/java/hudson/scm/browsers/QueryBuilder.java
+++ b/core/src/main/java/hudson/scm/browsers/QueryBuilder.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/search/QuickSilver.java b/core/src/main/java/hudson/search/QuickSilver.java
index 0d78712dc33e..43d71b9a61bd 100644
--- a/core/src/main/java/hudson/search/QuickSilver.java
+++ b/core/src/main/java/hudson/search/QuickSilver.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -43,7 +43,7 @@
*
* Such getter/field indicates an edge in the search graph, and will be added
* automatically by {@link SearchIndexBuilder#addAllAnnotations(SearchableModelObject)}
- * to a search index.
+ * to a search index.
*
* @author Kohsuke Kawaguchi
*/
diff --git a/core/src/main/java/hudson/search/Search.java b/core/src/main/java/hudson/search/Search.java
index 94bc989dac21..37971a7ee731 100644
--- a/core/src/main/java/hudson/search/Search.java
+++ b/core/src/main/java/hudson/search/Search.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Yahoo!, Inc.
- *
+ *
* 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
@@ -133,7 +133,7 @@ public void doSuggest(StaplerRequest req, StaplerResponse rsp, @QueryParameter S
*
* @return
* can be empty but never null. The size of the list is always smaller than
- * a certain threshold to avoid showing too many options.
+ * a certain threshold to avoid showing too many options.
*/
public SearchResult getSuggestions(StaplerRequest req, String query) {
Set paths = new HashSet<>(); // paths already added, to control duplicates
@@ -225,7 +225,7 @@ void find(SearchIndex index, String token, List result) {
* When there are multiple suggested items, this method can narrow down the resultset
* to the SuggestedItem that has a url that contains the query. This is useful is one
* job has a display name that matches another job's project name.
- * @param r A list of Suggested items. It is assumed that there is at least one
+ * @param r A list of Suggested items. It is assumed that there is at least one
* SuggestedItem in r.
* @param query A query string
* @return Returns the SuggestedItem which has a search url that contains the query.
@@ -241,12 +241,12 @@ static SuggestedItem findClosestSuggestedItem(List r, String quer
return curItem;
}
}
-
+
// couldn't find an item with the query in the url so just
// return the first one
- return r.get(0);
+ return r.get(0);
}
-
+
/**
* @deprecated Use {@link Search#find(SearchIndex, String, SearchableModelObject)} instead.
*/
@@ -254,7 +254,7 @@ static SuggestedItem findClosestSuggestedItem(List r, String quer
public static SuggestedItem find(SearchIndex index, String query) {
return find(index, query, null);
}
-
+
/**
* Performs a search and returns the match, or null if no match was found
* or more than one match was found.
@@ -262,7 +262,7 @@ public static SuggestedItem find(SearchIndex index, String query) {
*/
public static SuggestedItem find(SearchIndex index, String query, SearchableModelObject searchContext) {
List r = find(Mode.FIND, index, query, searchContext);
- if(r.isEmpty()){
+ if(r.isEmpty()){
return null;
}
else if(1==r.size()){
@@ -273,11 +273,11 @@ else if(1==r.size()){
// contains the query as this is probably the job's name
return findClosestSuggestedItem(r, query);
}
-
+
}
/**
- * @deprecated use {@link Search#suggest(SearchIndex, String, SearchableModelObject)} instead.
+ * @deprecated use {@link Search#suggest(SearchIndex, String, SearchableModelObject)} instead.
*/
@Deprecated
public static List suggest(SearchIndex index, final String tokenList) {
@@ -301,7 +301,6 @@ class Tag implements Comparable{
prefixMatch = i.getPath().startsWith(tokenList)?1:0;
}
- @SuppressFBWarnings(value = "EQ_COMPARETO_USE_OBJECT_EQUALS", justification = "TODO needs triage")
@Override
public int compareTo(Tag that) {
int r = this.prefixMatch -that.prefixMatch;
@@ -354,8 +353,8 @@ public int size() {
}
};
}
-
-
+
+
@Override
public String toString() {
StringBuilder s = new StringBuilder("TokenList{");
@@ -364,7 +363,7 @@ public String toString() {
s.append(",");
}
s.append('}');
-
+
return s.toString();
}
}
@@ -380,7 +379,7 @@ private static List find(Mode m, SearchIndex index, String tokenL
List items = new ArrayList<>(); // items found in 1 step
LOGGER.log(Level.FINE, "tokens={0}", tokens);
-
+
// first token
int w=1; // width of token
for (String token : tokens.subSequence(0)) {
diff --git a/core/src/main/java/hudson/search/SearchItems.java b/core/src/main/java/hudson/search/SearchItems.java
index 9edc46fd541b..0f9a2d63dd3d 100644
--- a/core/src/main/java/hudson/search/SearchItems.java
+++ b/core/src/main/java/hudson/search/SearchItems.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/security/BasicAuthenticationFilter.java b/core/src/main/java/hudson/security/BasicAuthenticationFilter.java
index d481260c3a4a..5fd45efb0bb6 100644
--- a/core/src/main/java/hudson/security/BasicAuthenticationFilter.java
+++ b/core/src/main/java/hudson/security/BasicAuthenticationFilter.java
@@ -98,7 +98,6 @@ public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
- @SuppressWarnings("ACL.impersonate")
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse rsp = (HttpServletResponse) response;
diff --git a/core/src/main/java/hudson/security/FederatedLoginService.java b/core/src/main/java/hudson/security/FederatedLoginService.java
index 036332c8c7ce..be1efda827a7 100644
--- a/core/src/main/java/hudson/security/FederatedLoginService.java
+++ b/core/src/main/java/hudson/security/FederatedLoginService.java
@@ -182,7 +182,6 @@ public final User locateUser() {
* to the caller of your "doXyz" method, it will either render an error page or initiate
* a user registration session (provided that {@link SecurityRealm} supports that.)
*/
- @SuppressWarnings("ACL.impersonate")
@NonNull
public User signin() throws UnclaimedIdentityException {
User u = locateUser();
diff --git a/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java b/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
index 3acab22bf065..bc9e9a01b70d 100644
--- a/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
+++ b/core/src/main/java/hudson/security/HudsonAuthenticationEntryPoint.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -54,7 +54,7 @@
*
*
* The page that programs see is entirely white, and it auto-redirects,
- * so humans wouldn't notice it.
+ * so humans wouldn't notice it.
*
* @author Kohsuke Kawaguchi
*/
diff --git a/core/src/main/java/hudson/security/HudsonFilter.java b/core/src/main/java/hudson/security/HudsonFilter.java
index fe08768f9d5e..74e48959f983 100644
--- a/core/src/main/java/hudson/security/HudsonFilter.java
+++ b/core/src/main/java/hudson/security/HudsonFilter.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -56,7 +56,7 @@ public class HudsonFilter implements Filter {
* The SecurityRealm specific filter.
*/
private volatile Filter filter;
-
+
/**
* The {@link #init(FilterConfig)} may be called before the Jenkins instance is up (which is
* required for initialization of the filter). So we store the
@@ -85,7 +85,7 @@ public class HudsonFilter implements Filter {
*/
@Deprecated
public static final UserDetailsServiceProxy USER_DETAILS_SERVICE_PROXY = new UserDetailsServiceProxy();
-
+
/**
* {@link RememberMeServices} proxy so that the Spring Security filter chain can stay the same
* even when security setting is reconfigured.
diff --git a/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java b/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
index 7c46a1bc65bc..d01449d38163 100644
--- a/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
+++ b/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
@@ -105,14 +105,14 @@
*/
public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRealm implements ModelObject, AccessControlled {
private static /* not final */ String ID_REGEX = System.getProperty(HudsonPrivateSecurityRealm.class.getName() + ".ID_REGEX");
-
+
/**
* Default REGEX for the user ID check in case the ID_REGEX is not set
* It allows A-Za-z0-9 + "_-"
* in Java {@code \w} is equivalent to {@code [A-Za-z0-9_]} (take care of "_")
*/
private static final String DEFAULT_ID_REGEX = "^[\\w-]+$";
-
+
/**
* If true, sign up is not allowed.
*
@@ -268,7 +268,6 @@ private User _doCreateAccount(StaplerRequest req, StaplerResponse rsp, String fo
/**
* Lets the current user silently login as the given user and report back accordingly.
*/
- @SuppressWarnings("ACL.impersonate")
private void loginAndTakeBack(StaplerRequest req, StaplerResponse rsp, User u) throws ServletException, IOException {
HttpSession session = req.getSession(false);
if (session != null) {
@@ -276,7 +275,7 @@ private void loginAndTakeBack(StaplerRequest req, StaplerResponse rsp, User u) t
session.invalidate();
}
req.getSession(true);
-
+
// ... and let him login
Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1"));
a = this.getSecurityComponents().manager2.authenticate(a);
diff --git a/core/src/main/java/hudson/security/SecurityMode.java b/core/src/main/java/hudson/security/SecurityMode.java
index 6119cd04e3ef..bcfa0b82919c 100644
--- a/core/src/main/java/hudson/security/SecurityMode.java
+++ b/core/src/main/java/hudson/security/SecurityMode.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -30,7 +30,7 @@
*/
public enum SecurityMode {
/**
- * None. Anyone can make any changes.
+ * None. Anyone can make any changes.
*/
UNSECURED,
/**
@@ -41,7 +41,7 @@ public enum SecurityMode {
* Authentication is performed by the container.
*
* This is the only secured mode of Hudson up to 1.160.
- * This is maintained only for backward compatibility.
+ * This is maintained only for backward compatibility.
*/
LEGACY,
/**
diff --git a/core/src/main/java/hudson/security/SidACL.java b/core/src/main/java/hudson/security/SidACL.java
index 870781031953..df8b375f7e46 100644
--- a/core/src/main/java/hudson/security/SidACL.java
+++ b/core/src/main/java/hudson/security/SidACL.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -114,7 +114,7 @@ protected Boolean _hasPermission(@NonNull Authentication a, Permission permissio
* true if the access should be granted, false if it should be denied.
* The null value indicates that the ACL does no rule for this Sid/Permission
* combination. The caller can decide what to do—such as consulting the higher level ACL,
- * or denying the access (if the model is no-access-by-default.)
+ * or denying the access (if the model is no-access-by-default.)
*/
protected abstract Boolean hasPermission(Sid p, Permission permission);
diff --git a/core/src/main/java/hudson/security/SparseACL.java b/core/src/main/java/hudson/security/SparseACL.java
index 1ba755049391..ad8f4d2e7a89 100644
--- a/core/src/main/java/hudson/security/SparseACL.java
+++ b/core/src/main/java/hudson/security/SparseACL.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/slaves/SlaveComputer.java b/core/src/main/java/hudson/slaves/SlaveComputer.java
index b5dc5eaff3e9..df915a0bf1ea 100644
--- a/core/src/main/java/hudson/slaves/SlaveComputer.java
+++ b/core/src/main/java/hudson/slaves/SlaveComputer.java
@@ -226,11 +226,11 @@ public TaskListener getListener() {
}
@Override
- public String getIcon() {
+ public String getIconClassName() {
Future> l = lastConnectActivity;
if(l!=null && !l.isDone())
- return "computer-flash.gif";
- return super.getIcon();
+ return "icon-computer-flash";
+ return super.getIconClassName();
}
/**
diff --git a/core/src/main/java/hudson/tasks/LogRotator.java b/core/src/main/java/hudson/tasks/LogRotator.java
index 89ba0cf3a9c4..996f35d382c3 100644
--- a/core/src/main/java/hudson/tasks/LogRotator.java
+++ b/core/src/main/java/hudson/tasks/LogRotator.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Martin Eigenbrodt
* Copyright (c) 2019 Intel Corporation
- *
+ *
* 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
@@ -53,20 +53,20 @@
* Default implementation of {@link BuildDiscarder}.
*
* For historical reason, this is called LogRotator, but it does not rotate logs :-)
- *
+ *
* Since 1.350 it has also the option to keep the build, but delete its recorded artifacts.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class LogRotator extends BuildDiscarder {
-
+
/** @deprecated Replaced by more generic {@link CompositeIOException}. */
@Deprecated
public static class CollatedLogRotatorException extends IOException {
private static final long serialVersionUID = 5944233808072651101L;
-
+
public final Collection collated;
-
+
public CollatedLogRotatorException(String msg, Exception... collated) {
super(msg);
if (collated == null || collated.length == 0) {
@@ -81,7 +81,7 @@ public CollatedLogRotatorException(String msg, Collection values) {
this.collated = values != null ? values : Collections.emptyList();
}
}
-
+
/**
* If not -1, history is only kept up to this days.
*/
@@ -135,17 +135,17 @@ public LogRotator(int daysToKeep, int numToKeep, int artifactDaysToKeep, int art
this.numToKeep = numToKeep;
this.artifactDaysToKeep = artifactDaysToKeep;
this.artifactNumToKeep = artifactNumToKeep;
-
+
}
-
+
@Override
@SuppressWarnings("rawtypes")
public void perform(Job,?> job) throws IOException, InterruptedException {
//Exceptions thrown by the deletion submethods are collated and reported
Map, Set> exceptionMap = new HashMap<>();
-
+
LOGGER.log(FINE, "Running the log rotation for {0} with numToKeep={1} daysToKeep={2} artifactNumToKeep={3} artifactDaysToKeep={4}", new Object[] {job, numToKeep, daysToKeep, artifactNumToKeep, artifactDaysToKeep});
-
+
// always keep the last successful and the last stable builds
Run lsb = job.getLastSuccessfulBuild();
Run lstb = job.getLastStableBuild();
@@ -212,7 +212,7 @@ public void perform(Job,?> job) throws IOException, InterruptedException {
r = r.getNextBuild();
}
}
-
+
if (!exceptionMap.isEmpty()) {
//Collate all encountered exceptions into a single exception and throw that
String msg = String.format(
diff --git a/core/src/main/java/hudson/triggers/SCMTrigger.java b/core/src/main/java/hudson/triggers/SCMTrigger.java
index 05b3fa1ea5fe..7d3d5e285cae 100644
--- a/core/src/main/java/hudson/triggers/SCMTrigger.java
+++ b/core/src/main/java/hudson/triggers/SCMTrigger.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Brian Westrich, Jean-Baptiste Quenot, id:cactusman
* 2015 Kanstantsin Shautsou
- *
+ *
* 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
@@ -96,14 +96,14 @@
*
* You can add UI elements under the SCM section by creating a
* config.jelly or config.groovy in the resources area for
- * your class that inherits from SCMTrigger and has the
- * {@link Extension} annotation. The UI should
+ * your class that inherits from SCMTrigger and has the
+ * {@link Extension} annotation. The UI should
* be wrapped in an f:section element to denote it.
*
* @author Kohsuke Kawaguchi
*/
public class SCMTrigger extends Trigger {
-
+
private boolean ignorePostCommitHooks;
@DataBoundConstructor
@@ -131,7 +131,7 @@ public SCMTrigger(String scmpoll_spec, boolean ignorePostCommitHooks) throws ANT
* This trigger wants to ignore post-commit hooks.
*
* SCM plugins must respect this and not run this trigger for post-commit notifications.
- *
+ *
* @since 1.493
*/
public boolean isIgnorePostCommitHooks() {
@@ -167,7 +167,7 @@ public void run() {
/**
* Run the SCM trigger with additional build actions. Used by SubversionRepositoryStatus
* to trigger a build at a specific revision number.
- *
+ *
* @since 1.375
*/
public void run(Action[] additionalActions) {
@@ -179,14 +179,14 @@ public void run(Action[] additionalActions) {
LOGGER.fine("Scheduling a polling for "+job);
if (d.synchronousPolling) {
- LOGGER.fine("Running the trigger directly without threading, " +
- "as it's already taken care of by Trigger.Cron");
+ LOGGER.fine("Running the trigger directly without threading, " +
+ "as it's already taken care of by Trigger.Cron");
new Runner(additionalActions).run();
} else {
// schedule the polling.
// even if we end up submitting this too many times, that's OK.
// the real exclusion control happens inside Runner.
- LOGGER.fine("scheduling the trigger to (asynchronously) run");
+ LOGGER.fine("scheduling the trigger to (asynchronously) run");
d.queue.execute(new Runner(additionalActions));
d.clogCheck();
}
@@ -426,7 +426,7 @@ public BuildAction(Run,?> run) {
this.run = run;
build = run instanceof AbstractBuild ? (AbstractBuild) run : null;
}
-
+
@Deprecated
public BuildAction(AbstractBuild build) {
this((Run) build);
@@ -476,7 +476,7 @@ public void doPollingLog(StaplerRequest req, StaplerResponse rsp) throws IOExcep
public AnnotatedLargeText getPollingLogText() {
return new AnnotatedLargeText<>(getPollingLogFile(), Charset.defaultCharset(), true, this);
}
-
+
/**
* Used from {@code polling.jelly} to write annotated polling log to the given output.
*/
@@ -562,12 +562,9 @@ public class Runner implements Runnable {
public Runner() {
this(null);
}
-
- @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH", justification = "False positive")
+
public Runner(Action[] actions) {
- if (job == null) {
- throw new NullPointerException("Runner can't be instantiated when job is null");
- }
+ Objects.requireNonNull(job, "Runner can't be instantiated when job is null");
if (actions == null) {
additionalActions = new Action[0];
@@ -575,7 +572,7 @@ public Runner(Action[] actions) {
additionalActions = Arrays.copyOf(actions, actions.length);
}
}
-
+
/**
* Where the log file is written.
*/
diff --git a/core/src/main/java/hudson/triggers/TimerTrigger.java b/core/src/main/java/hudson/triggers/TimerTrigger.java
index 290cf9534cd7..79cfb78d323b 100644
--- a/core/src/main/java/hudson/triggers/TimerTrigger.java
+++ b/core/src/main/java/hudson/triggers/TimerTrigger.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Martin Eigenbrodt
* 2015 Kanstantsin Shautsou
- *
+ *
* 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
@@ -82,7 +82,7 @@ public String getDisplayName() {
public FormValidation doCheck(@QueryParameter String value, @AncestorInPath Item item) {
return doCheckSpec(value, item);
}
-
+
/**
* Performs syntax check.
*/
@@ -120,7 +120,7 @@ private void updateValidationsForNextRun(Collection validations,
}
}
}
-
+
public static class TimerTriggerCause extends Cause {
@Override
public String getShortDescription() {
diff --git a/core/src/main/java/hudson/triggers/Trigger.java b/core/src/main/java/hudson/triggers/Trigger.java
index 5126c8925da4..a308e004559a 100644
--- a/core/src/main/java/hudson/triggers/Trigger.java
+++ b/core/src/main/java/hudson/triggers/Trigger.java
@@ -258,12 +258,15 @@ public static void checkTriggers(final Calendar cal) {
// terminated.
// FIXME allow to set a global crontab spec
previousSynchronousPolling = scmd.getExecutor().submit(new DependencyRunner(new ProjectRunnable() {
- @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH", justification = "TODO needs triage")
@Override
public void run(AbstractProject p) {
for (Trigger t : (Collection) p.getTriggers().values()) {
if (t instanceof SCMTrigger) {
- LOGGER.fine("synchronously triggering SCMTrigger for project " + t.job.getName());
+ if (t.job != null) {
+ LOGGER.fine("synchronously triggering SCMTrigger for project " + t.job.getName());
+ } else {
+ LOGGER.fine("synchronously triggering SCMTrigger for unknown project");
+ }
t.run();
}
}
diff --git a/core/src/main/java/hudson/util/ComboBoxModel.java b/core/src/main/java/hudson/util/ComboBoxModel.java
index 210ee09f0200..af1a81cb5fcd 100644
--- a/core/src/main/java/hudson/util/ComboBoxModel.java
+++ b/core/src/main/java/hudson/util/ComboBoxModel.java
@@ -38,7 +38,7 @@
/**
* Model object for dynamically filed combo box, which is really just {@code ArrayList}
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class ComboBoxModel extends ArrayList implements HttpResponse {
diff --git a/core/src/main/java/hudson/util/CompressedFile.java b/core/src/main/java/hudson/util/CompressedFile.java
index 648972716144..1b4dac135e61 100644
--- a/core/src/main/java/hudson/util/CompressedFile.java
+++ b/core/src/main/java/hudson/util/CompressedFile.java
@@ -25,7 +25,6 @@
import com.jcraft.jzlib.GZIPInputStream;
import com.jcraft.jzlib.GZIPOutputStream;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Util;
import java.io.File;
import java.io.FileNotFoundException;
@@ -36,6 +35,7 @@
import java.io.Reader;
import java.nio.charset.Charset;
import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -137,20 +137,32 @@ public String loadAsString() throws IOException {
*/
public void compress() {
compressionThread.submit(new Runnable() {
- @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification = "TODO needs triage")
@Override
public void run() {
- try {
- try (InputStream in = read();
- OutputStream os = Files.newOutputStream(gz.toPath());
- OutputStream out = new GZIPOutputStream(os)) {
- org.apache.commons.io.IOUtils.copy(in, out);
- }
+ boolean success;
+ try (InputStream in = read();
+ OutputStream os = Files.newOutputStream(gz.toPath());
+ OutputStream out = new GZIPOutputStream(os)) {
+ org.apache.commons.io.IOUtils.copy(in, out);
+ out.flush();
+ success = true;
+ } catch (IOException | InvalidPathException e) {
+ LOGGER.log(Level.WARNING, "Failed to compress " + file, e);
+ success = false;
+ }
+
+ File fileToDelete;
+ if (success) {
// if the compressed file is created successfully, remove the original
- file.delete();
- } catch (IOException e) {
- LOGGER.log(Level.WARNING, "Failed to compress "+file,e);
- gz.delete(); // in case a processing is left in the middle
+ fileToDelete = file;
+ } else {
+ // in case a processing is left in the middle
+ fileToDelete = gz;
+ }
+ try {
+ Files.deleteIfExists(fileToDelete.toPath());
+ } catch (IOException | InvalidPathException e) {
+ LOGGER.log(Level.WARNING, "Failed to delete " + fileToDelete, e);
}
}
});
diff --git a/core/src/main/java/hudson/util/DirScanner.java b/core/src/main/java/hudson/util/DirScanner.java
index b31d9ad5dfd1..e78c63f41d3c 100644
--- a/core/src/main/java/hudson/util/DirScanner.java
+++ b/core/src/main/java/hudson/util/DirScanner.java
@@ -150,7 +150,7 @@ public void scan(File dir, FileVisitor visitor) throws IOException {
private static final long serialVersionUID = 1L;
}
-
+
private static class DescendantFileSelector implements FileSelector{
private final Set alreadyDeselected;
private final FilePath baseDirFP;
@@ -161,7 +161,7 @@ private DescendantFileSelector(File basedir){
this.baseDirPathLength = basedir.getPath().length();
this.alreadyDeselected = new HashSet<>();
}
-
+
@Override
public boolean isSelected(File basedir, String filename, File file) throws BuildException {
String parentName = file.getParent();
diff --git a/core/src/main/java/hudson/util/DoubleLaunchChecker.java b/core/src/main/java/hudson/util/DoubleLaunchChecker.java
index 44a76b264cb7..b6c6400a5859 100644
--- a/core/src/main/java/hudson/util/DoubleLaunchChecker.java
+++ b/core/src/main/java/hudson/util/DoubleLaunchChecker.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -87,7 +87,7 @@ public class DoubleLaunchChecker {
public final File home;
/**
- * ID string of the other Hudson that we are colliding with.
+ * ID string of the other Hudson that we are colliding with.
* Can be null.
*/
private String collidingId;
diff --git a/core/src/main/java/hudson/util/ErrorObject.java b/core/src/main/java/hudson/util/ErrorObject.java
index 26fb2f2f27ef..da9f6b292bbf 100644
--- a/core/src/main/java/hudson/util/ErrorObject.java
+++ b/core/src/main/java/hudson/util/ErrorObject.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/util/FormFieldValidator.java b/core/src/main/java/hudson/util/FormFieldValidator.java
index 466b65b3e891..8fb9bb219c5a 100644
--- a/core/src/main/java/hudson/util/FormFieldValidator.java
+++ b/core/src/main/java/hudson/util/FormFieldValidator.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jene Jasper, Tom Huybrechts
- *
+ *
* 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
@@ -361,7 +361,7 @@ private HttpURLConnection openConnection(URL url) throws IOException {
* Checks the file mask (specified in the 'value' query parameter) against
* the current workspace.
* @since 1.90.
- * @deprecated as of 1.294. Use {@link FilePath#validateFileMask(String, boolean, boolean)}
+ * @deprecated as of 1.294. Use {@link FilePath#validateFileMask(String, boolean, boolean)}
*/
@Deprecated
public static class WorkspaceFileMask extends FormFieldValidator {
@@ -622,7 +622,7 @@ protected void check() throws IOException, ServletException {
fail();
return;
}
-
+
java.util.Base64.getDecoder().decode(v);
ok();
} catch (IOException | IllegalArgumentException e) {
diff --git a/core/src/main/java/hudson/util/Function1.java b/core/src/main/java/hudson/util/Function1.java
index aa7535d5903f..78fe9d085110 100644
--- a/core/src/main/java/hudson/util/Function1.java
+++ b/core/src/main/java/hudson/util/Function1.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -25,7 +25,7 @@
/**
* Unary function {@code y=f(x)}.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public interface Function1 {
diff --git a/core/src/main/java/hudson/util/HudsonIsLoading.java b/core/src/main/java/hudson/util/HudsonIsLoading.java
index 49d04dc30152..14980e82835f 100644
--- a/core/src/main/java/hudson/util/HudsonIsLoading.java
+++ b/core/src/main/java/hudson/util/HudsonIsLoading.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -36,7 +36,7 @@
*
* Set this object to {@link ServletContext#setAttribute(String, Object)} "app" while
* the loading activity is taking place.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class HudsonIsLoading {
diff --git a/core/src/main/java/hudson/util/HudsonIsRestarting.java b/core/src/main/java/hudson/util/HudsonIsRestarting.java
index 984022c67657..cf3ce0cbdad3 100644
--- a/core/src/main/java/hudson/util/HudsonIsRestarting.java
+++ b/core/src/main/java/hudson/util/HudsonIsRestarting.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/util/OneShotEvent.java b/core/src/main/java/hudson/util/OneShotEvent.java
index 19e119b5dfe2..ceec02dc2b48 100644
--- a/core/src/main/java/hudson/util/OneShotEvent.java
+++ b/core/src/main/java/hudson/util/OneShotEvent.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -33,7 +33,7 @@
*
*
* Once the event becomes signaled, or the pandora's box is opened,
- * every thread gets through freely, and there's no way to turn it back off.
+ * every thread gets through freely, and there's no way to turn it back off.
*
* @author Kohsuke Kawaguchi
*/
diff --git a/core/src/main/java/hudson/util/ProcessTree.java b/core/src/main/java/hudson/util/ProcessTree.java
index 3be9c62d57ee..37f10c8cd2c1 100644
--- a/core/src/main/java/hudson/util/ProcessTree.java
+++ b/core/src/main/java/hudson/util/ProcessTree.java
@@ -109,7 +109,7 @@ public abstract class ProcessTree implements Iterable, IProcessTree,
* Lazily obtained {@link ProcessKiller}s to be applied on this process tree.
*/
private transient volatile List killers;
-
+
/**
* Flag to skip the veto check since there aren't any.
*/
@@ -119,7 +119,7 @@ public abstract class ProcessTree implements Iterable, IProcessTree,
private ProcessTree() {
skipVetoes = false;
}
-
+
private ProcessTree(boolean vetoesExist) {
skipVetoes = !vetoesExist;
}
@@ -288,12 +288,12 @@ void killByKiller() throws InterruptedException {
public abstract void killRecursively() throws InterruptedException;
/**
- * @return The first non-null {@link VetoCause} provided by a process killing veto extension for this OSProcess.
+ * @return The first non-null {@link VetoCause} provided by a process killing veto extension for this OSProcess.
* null if no one objects killing the process.
*/
protected @CheckForNull VetoCause getVeto() {
String causeMessage = null;
-
+
// Quick check, does anything exist to check against
if (!skipVetoes) {
try {
@@ -308,7 +308,7 @@ void killByKiller() throws InterruptedException {
LOGGER.log(Level.WARNING, "Interrupted Exception while checking for vetoes", e);
}
}
-
+
if (causeMessage != null) {
return new VetoCause(causeMessage);
}
@@ -368,14 +368,14 @@ public T act(ProcessCallable callable) throws IOException, InterruptedExc
Object writeReplace() {
return new SerializedProcess(pid);
}
-
+
private class CheckVetoes extends SlaveToMasterCallable {
private IOSProcess process;
-
+
CheckVetoes(IOSProcess processToCheck) {
process = processToCheck;
}
-
+
@Override
public String call() throws IOException {
for (ProcessKillingVeto vetoExtension : ProcessKillingVeto.all()) {
@@ -429,7 +429,7 @@ public interface ProcessCallable extends Serializable {
/* package */ static volatile Boolean vetoersExist;
-
+
/**
* Gets the {@link ProcessTree} of the current system
* that JVM runs in, or in the worst case return the default one
@@ -458,10 +458,10 @@ public static ProcessTree get() {
LOGGER.log(Level.WARNING, "Error while determining if vetoers exist", e);
}
}
-
+
// Null-check in case the previous call worked
boolean vetoes = vetoersExist == null ? true : vetoersExist;
-
+
try {
if(File.pathSeparatorChar==';')
return new Windows(vetoes);
@@ -484,7 +484,7 @@ public static ProcessTree get() {
return DEFAULT;
}
-
+
private static class DoVetoersExist extends SlaveToMasterCallable {
@Override
public Boolean call() throws IOException {
@@ -519,7 +519,7 @@ public void killRecursively() {
@Override
public void kill() throws InterruptedException {
- if (getVeto() != null)
+ if (getVeto() != null)
return;
proc.destroy();
killByKiller();
@@ -546,11 +546,11 @@ public void killAll(@NonNull Map modelEnvVars) {
};
private class WindowsOSProcess extends OSProcess {
-
+
private final WinProcess p;
private EnvVars env;
private List args;
-
+
WindowsOSProcess(WinProcess p) {
super(p.getPid());
this.p = p;
@@ -565,7 +565,7 @@ public OSProcess getParent() {
@Override
public void killRecursively() throws InterruptedException {
- if (getVeto() != null)
+ if (getVeto() != null)
return;
LOGGER.log(FINER, "Killing recursively {0}", getPid());
@@ -580,7 +580,7 @@ public void kill() throws InterruptedException {
if (getVeto() != null) {
return;
}
-
+
LOGGER.log(FINER, "Killing {0}", getPid());
// Firstly try to kill it gracefully, then do a forcekill if it does not help (algorithm is described in JENKINS-17116)
killSoftly();
@@ -636,7 +636,7 @@ public synchronized EnvVars getEnvironmentVariables() {
}
return env;
}
-
+
private synchronized EnvVars getEnvironmentVariables2() throws WindowsOSProcessException {
if(env !=null) {
return env;
@@ -650,7 +650,7 @@ private synchronized EnvVars getEnvironmentVariables2() throws WindowsOSProcessE
}
return env;
}
-
+
private boolean hasMatchingEnvVars2(Map modelEnvVar) throws WindowsOSProcessException {
if(modelEnvVar.isEmpty())
// sanity check so that we don't start rampage.
@@ -666,8 +666,8 @@ private boolean hasMatchingEnvVars2(Map modelEnvVar) throws Windo
return true;
}
}
-
- //TODO: Cleanup once Winp provides proper API
+
+ //TODO: Cleanup once Winp provides proper API
/**
* Wrapper for runtime {@link WinpException}.
*/
@@ -675,7 +675,7 @@ private static class WindowsOSProcessException extends Exception {
WindowsOSProcessException(WinpException ex) {
super(ex);
}
-
+
WindowsOSProcessException(String message, WinpException ex) {
super(message, ex);
}
@@ -684,7 +684,7 @@ private static class WindowsOSProcessException extends Exception {
private static final class Windows extends Local {
Windows(boolean vetoesExist) {
super(vetoesExist);
-
+
for (final WinProcess p : WinProcess.all()) {
int pid = p.getPid();
if(pid == 0 || pid == 4) continue; // skip the System Idle and System processes
@@ -729,7 +729,7 @@ public void killAll(@NonNull Map modelEnvVars) throws Interrupte
static {
WinProcess.enableDebugPrivilege();
}
-
+
private static boolean hasMatchingEnvVars(@NonNull OSProcess p, @NonNull Map modelEnvVars)
throws WindowsOSProcessException {
if (p instanceof WindowsOSProcess) {
@@ -770,7 +770,7 @@ public void killAll(@NonNull Map modelEnvVars) throws Interrupte
abstract static class ProcfsUnix extends Unix {
ProcfsUnix(boolean vetoersExist) {
super(vetoersExist);
-
+
File[] processes = new File("/proc").listFiles(File::isDirectory);
if(processes==null) {
LOGGER.info("No /proc");
@@ -819,7 +819,7 @@ public void kill() throws InterruptedException {
}
private void kill(long deadline) throws InterruptedException {
- if (getVeto() != null)
+ if (getVeto() != null)
return;
try {
int pid = getPid();
@@ -972,7 +972,7 @@ static class Linux extends ProcfsUnix {
Linux(boolean vetoersExist) {
super(vetoersExist);
}
-
+
@Override
protected LinuxProcess createProcess(int pid) throws IOException {
return new LinuxProcess(pid);
@@ -1086,7 +1086,7 @@ static class AIX extends ProcfsUnix {
AIX(boolean vetoersExist) {
super(vetoersExist);
}
-
+
@Override
protected OSProcess createProcess(final int pid) throws IOException {
return new AIXProcess(pid);
@@ -1121,44 +1121,44 @@ private AIXProcess(int pid) throws IOException {
super(pid);
try (RandomAccessFile pstatus = new RandomAccessFile(getFile("status"), "r")) {
- // typedef struct pstatus {
- // uint32_t pr_flag; /* process flags from proc struct p_flag */
- // uint32_t pr_flag2; /* process flags from proc struct p_flag2 */
- // uint32_t pr_flags; /* /proc flags */
- // uint32_t pr_nlwp; /* number of threads in the process */
- // char pr_stat; /* process state from proc p_stat */
- // char pr_dmodel; /* data model for the process */
- // char pr__pad1[6]; /* reserved for future use */
- // pr_sigset_t pr_sigpend; /* set of process pending signals */
- // prptr64_t pr_brkbase; /* address of the process heap */
- // uint64_t pr_brksize; /* size of the process heap, in bytes */
- // prptr64_t pr_stkbase; /* address of the process stack */
- // uint64_t pr_stksize; /* size of the process stack, in bytes */
- // uint64_t pr_pid; /* process id */
- // uint64_t pr_ppid; /* parent process id */
- // uint64_t pr_pgid; /* process group id */
- // uint64_t pr_sid; /* session id */
- // pr_timestruc64_t pr_utime; /* process user cpu time */
- // pr_timestruc64_t pr_stime; /* process system cpu time */
- // pr_timestruc64_t pr_cutime; /* sum of children's user times */
- // pr_timestruc64_t pr_cstime; /* sum of children's system times */
- // pr_sigset_t pr_sigtrace; /* mask of traced signals */
- // fltset_t pr_flttrace; /* mask of traced hardware faults */
- // uint32_t pr_sysentry_offset; /* offset into pstatus file of sysset_t
- // * identifying system calls traced on
- // * entry. If 0, then no entry syscalls
- // * are being traced. */
- // uint32_t pr_sysexit_offset; /* offset into pstatus file of sysset_t
- // * identifying system calls traced on
- // * exit. If 0, then no exit syscalls
- // * are being traced. */
- // uint64_t pr__pad[8]; /* reserved for future use */
- // lwpstatus_t pr_lwp; /* "representative" thread status */
- // } pstatus_t;
+ // typedef struct pstatus {
+ // uint32_t pr_flag; /* process flags from proc struct p_flag */
+ // uint32_t pr_flag2; /* process flags from proc struct p_flag2 */
+ // uint32_t pr_flags; /* /proc flags */
+ // uint32_t pr_nlwp; /* number of threads in the process */
+ // char pr_stat; /* process state from proc p_stat */
+ // char pr_dmodel; /* data model for the process */
+ // char pr__pad1[6]; /* reserved for future use */
+ // pr_sigset_t pr_sigpend; /* set of process pending signals */
+ // prptr64_t pr_brkbase; /* address of the process heap */
+ // uint64_t pr_brksize; /* size of the process heap, in bytes */
+ // prptr64_t pr_stkbase; /* address of the process stack */
+ // uint64_t pr_stksize; /* size of the process stack, in bytes */
+ // uint64_t pr_pid; /* process id */
+ // uint64_t pr_ppid; /* parent process id */
+ // uint64_t pr_pgid; /* process group id */
+ // uint64_t pr_sid; /* session id */
+ // pr_timestruc64_t pr_utime; /* process user cpu time */
+ // pr_timestruc64_t pr_stime; /* process system cpu time */
+ // pr_timestruc64_t pr_cutime; /* sum of children's user times */
+ // pr_timestruc64_t pr_cstime; /* sum of children's system times */
+ // pr_sigset_t pr_sigtrace; /* mask of traced signals */
+ // fltset_t pr_flttrace; /* mask of traced hardware faults */
+ // uint32_t pr_sysentry_offset; /* offset into pstatus file of sysset_t
+ // * identifying system calls traced on
+ // * entry. If 0, then no entry syscalls
+ // * are being traced. */
+ // uint32_t pr_sysexit_offset; /* offset into pstatus file of sysset_t
+ // * identifying system calls traced on
+ // * exit. If 0, then no exit syscalls
+ // * are being traced. */
+ // uint64_t pr__pad[8]; /* reserved for future use */
+ // lwpstatus_t pr_lwp; /* "representative" thread status */
+ // } pstatus_t;
pstatus.seek(17); // offset of pr_dmodel
- byte pr_dmodel = pstatus.readByte();
+ byte pr_dmodel = pstatus.readByte();
if (pr_dmodel == PR_MODEL_ILP32) {
b64 = false;
@@ -1173,7 +1173,7 @@ private AIXProcess(int pid) throws IOException {
if (adjust((int)pstatus.readLong()) != pid)
throw new IOException("pstatus PID mismatch"); // sanity check
- ppid = adjust((int)pstatus.readLong()); // AIX pids are stored as a 64 bit integer,
+ ppid = adjust((int)pstatus.readLong()); // AIX pids are stored as a 64 bit integer,
// but the first 4 bytes are always 0
}
@@ -1269,7 +1269,7 @@ public synchronized List getArguments() {
arguments.add(readLine(fd, addr, "arg["+ n +"]"));
}
} finally {
- LIBC.close(fd);
+ LIBC.close(fd);
}
} catch (IOException | LastErrorException e) {
// failed to read. this can happen under normal circumstances (most notably permission denied)
@@ -1317,7 +1317,7 @@ public synchronized EnvVars getEnvironmentVariables() {
envVars.addLine(readLine(fd, addr, "env["+ n +"]"));
}
} finally {
- LIBC.close(fd);
+ LIBC.close(fd);
}
} catch (IOException | LastErrorException e) {
// failed to read. this can happen under normal circumstances (most notably permission denied)
@@ -1417,7 +1417,7 @@ static class Solaris extends ProcfsUnix {
Solaris(boolean vetoersExist) {
super(vetoersExist);
}
-
+
@Override
protected OSProcess createProcess(final int pid) throws IOException {
return new SolarisProcess(pid);
@@ -1535,9 +1535,9 @@ public synchronized List getArguments() {
return arguments;
arguments = new ArrayList<>(argc);
- if (argc == 0) {
- return arguments;
- }
+ if (argc == 0) {
+ return arguments;
+ }
int psize = b64 ? 8 : 4;
Memory m = new Memory(psize);
@@ -1572,9 +1572,9 @@ public synchronized EnvVars getEnvironmentVariables() {
return envVars;
envVars = new EnvVars();
- if (envp == 0) {
- return envVars;
- }
+ if (envp == 0) {
+ return envVars;
+ }
int psize = b64 ? 8 : 4;
Memory m = new Memory(psize);
@@ -2133,7 +2133,7 @@ public abstract static class Local extends ProcessTree {
@Deprecated
Local() {
}
-
+
Local(boolean vetoesExist) {
super(vetoesExist);
}
@@ -2151,10 +2151,10 @@ public Remote(ProcessTree proxy, Channel ch) {
for (Map.Entry e : proxy.processes.entrySet())
processes.put(e.getKey(),new RemoteProcess(e.getValue(),ch));
}
-
+
public Remote(ProcessTree proxy, Channel ch, boolean vetoersExist) {
super(vetoersExist);
-
+
this.proxy = ch.export(IProcessTree.class,proxy);
for (Map.Entry e : proxy.processes.entrySet())
processes.put(e.getKey(),new RemoteProcess(e.getValue(),ch));
diff --git a/core/src/main/java/hudson/util/RobustReflectionConverter.java b/core/src/main/java/hudson/util/RobustReflectionConverter.java
index 96b10f6ef9e4..368a5e4ffa74 100644
--- a/core/src/main/java/hudson/util/RobustReflectionConverter.java
+++ b/core/src/main/java/hudson/util/RobustReflectionConverter.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, 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
@@ -122,7 +122,7 @@ void addCriticalField(Class> clazz, String field) {
criticalFieldsLock.writeLock().unlock();
}
}
-
+
private boolean hasCriticalField(Class> clazz, String field) {
// Lock the write lock
criticalFieldsLock.readLock().lock();
@@ -383,7 +383,7 @@ public Object doUnmarshal(final Object result, final HierarchicalStreamReader re
// Report any class/field errors in Saveable objects if it happens during loading of existing data from disk
if (shouldReportUnloadableDataForCurrentUser() && context.get("ReadError") != null && context.get("Saveable") == result) {
// Avoid any error in OldDataMonitor to be catastrophic. See JENKINS-62231 and JENKINS-59582
- // The root cause is the OldDataMonitor extension is not ready before a plugin triggers an error, for
+ // The root cause is the OldDataMonitor extension is not ready before a plugin triggers an error, for
// example when trying to load a field that was created by a new version and you downgrade to the previous
// one.
try {
diff --git a/core/src/main/java/hudson/util/Secret.java b/core/src/main/java/hudson/util/Secret.java
index 6da075b331a5..d352b43803b0 100644
--- a/core/src/main/java/hudson/util/Secret.java
+++ b/core/src/main/java/hudson/util/Secret.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
* Copyright (c) 2016, CloudBees Inc.
- *
+ *
* 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
@@ -122,7 +122,7 @@ public int hashCode() {
/**
* Encrypts {@link #value} and returns it in an encoded printable form.
*
- * @see #toString()
+ * @see #toString()
*/
public String getEncryptedValue() {
try {
diff --git a/core/src/main/java/hudson/util/Service.java b/core/src/main/java/hudson/util/Service.java
index 7b33d8b55b1b..6ea3f7955c1c 100644
--- a/core/src/main/java/hudson/util/Service.java
+++ b/core/src/main/java/hudson/util/Service.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/hudson/util/WriterOutputStream.java b/core/src/main/java/hudson/util/WriterOutputStream.java
deleted file mode 100644
index e86986109756..000000000000
--- a/core/src/main/java/hudson/util/WriterOutputStream.java
+++ /dev/null
@@ -1,138 +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.util;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
-import java.nio.charset.StandardCharsets;
-import java.nio.charset.UnsupportedCharsetException;
-
-/**
- * {@link OutputStream} that writes to {@link Writer}
- * by assuming the platform default encoding.
- *
- * @author Kohsuke Kawaguchi
- * @deprecated since 2008-05-28.
- * Use the one in stapler.
- */
-@Deprecated
-public class WriterOutputStream extends OutputStream {
- private final Writer writer;
- private final CharsetDecoder decoder;
-
- private java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocate(1024);
- private CharBuffer out = CharBuffer.allocate(1024);
-
- public WriterOutputStream(Writer out) {
- this.writer = out;
- decoder = DEFAULT_CHARSET.newDecoder();
- decoder.onMalformedInput(CodingErrorAction.REPLACE);
- decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- }
-
- @Override
- public void write(int b) throws IOException {
- if(buf.remaining()==0)
- decode(false);
- buf.put((byte)b);
- }
-
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- while(len>0) {
- if(buf.remaining()==0)
- decode(false);
- int sz = Math.min(buf.remaining(),len);
- buf.put(b,off,sz);
- off += sz;
- len -= sz;
- }
- }
-
- @Override
- public void flush() throws IOException {
- decode(false);
- flushOutput();
- writer.flush();
- }
-
- private void flushOutput() throws IOException {
- writer.write(out.array(),0,out.position());
- out.clear();
- }
-
- @Override
- public void close() throws IOException {
- decode(true);
- flushOutput();
- writer.close();
-
- buf.rewind();
- }
-
- /**
- * Decodes the contents of {@link #buf} as much as possible to {@link #out}.
- * If necessary {@link #out} is further sent to {@link #writer}.
- *
- *
- * When this method returns, the {@link #buf} is back to the 'accumulation'
- * mode.
- *
- * @param last
- * if true, tell the decoder that all the input bytes are ready.
- */
- private void decode(boolean last) throws IOException {
- buf.flip();
- while(true) {
- CoderResult r = decoder.decode(buf, out, last);
- if(r==CoderResult.OVERFLOW) {
- flushOutput();
- continue;
- }
- if(r==CoderResult.UNDERFLOW) {
- buf.compact();
- return;
- }
- // otherwise treat it as an error
- r.throwException();
- }
- }
-
- private static final Charset DEFAULT_CHARSET = getDefaultCharset();
-
- private static Charset getDefaultCharset() {
- try {
- String encoding = System.getProperty("file.encoding");
- return Charset.forName(encoding);
- } catch (UnsupportedCharsetException e) {
- return StandardCharsets.UTF_8;
- }
- }
-}
diff --git a/core/src/main/java/hudson/util/jna/package-info.java b/core/src/main/java/hudson/util/jna/package-info.java
index 637a0c66ffdd..a2abf2e79aa3 100644
--- a/core/src/main/java/hudson/util/jna/package-info.java
+++ b/core/src/main/java/hudson/util/jna/package-info.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/core/src/main/java/jenkins/PluginSubtypeMarker.java b/core/src/main/java/jenkins/PluginSubtypeMarker.java
index 162347ddda12..3a115ed37389 100644
--- a/core/src/main/java/jenkins/PluginSubtypeMarker.java
+++ b/core/src/main/java/jenkins/PluginSubtypeMarker.java
@@ -54,7 +54,6 @@
*/
@SupportedAnnotationTypes("*")
@MetaInfServices(Processor.class)
-@SuppressWarnings("Since15")
public class PluginSubtypeMarker extends AbstractProcessor {
@Override
public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
diff --git a/core/src/main/java/jenkins/fingerprints/FingerprintStorage.java b/core/src/main/java/jenkins/fingerprints/FingerprintStorage.java
index 39323ec38a16..e1692aae7a37 100644
--- a/core/src/main/java/jenkins/fingerprints/FingerprintStorage.java
+++ b/core/src/main/java/jenkins/fingerprints/FingerprintStorage.java
@@ -55,7 +55,7 @@ public static FingerprintStorage get() {
/**
* Returns the file system based {@link FileFingerprintStorage} configured on the system.
- * @deprecated since TODO, use {@code ExtensionList.lookupSingleton(FileFingerprintStorage.class)} instead.
+ * @deprecated since 2.324, use {@code ExtensionList.lookupSingleton(FileFingerprintStorage.class)} instead.
*/
@Deprecated
public static FingerprintStorage getFileFingerprintStorage() {
diff --git a/core/src/main/java/jenkins/install/InstallUtil.java b/core/src/main/java/jenkins/install/InstallUtil.java
index bf126df40a27..3cd4079e9341 100644
--- a/core/src/main/java/jenkins/install/InstallUtil.java
+++ b/core/src/main/java/jenkins/install/InstallUtil.java
@@ -85,7 +85,7 @@ public T get() {
return functions.next().apply(this);
}
}
-
+
/**
* Proceed to the state following the provided one
*/
@@ -95,7 +95,7 @@ public static void proceedToNextStateFrom(InstallState prior) {
Jenkins.get().setInstallState(next);
}
}
-
+
/**
* Returns the next state during a transition from the current install state
*/
@@ -106,7 +106,7 @@ public static void proceedToNextStateFrom(InstallState prior) {
}
// Terminal condition: getNextState() on the current install state
installStateFilterChain.add(input -> {
- // Initially, install state is unknown and
+ // Initially, install state is unknown and
// needs to be determined
if (current == null || InstallState.UNKNOWN.equals(current)) {
return getDefaultInstallState();
@@ -124,11 +124,11 @@ public static void proceedToNextStateFrom(InstallState prior) {
}
return states.get(current);
});
-
+
ProviderChain chain = new ProviderChain<>(installStateFilterChain.iterator());
return chain.get();
}
-
+
private static InstallState getDefaultInstallState() {
// Support a simple state override. Useful for testing.
String stateOverride = System.getProperty("jenkins.install.state", System.getenv("jenkins.install.state"));
@@ -139,18 +139,18 @@ private static InstallState getDefaultInstallState() {
throw new IllegalStateException("Unknown install state override specified on the commandline: '" + stateOverride + "'.", e);
}
}
-
+
// Support a 3-state flag for running or disabling the setup wizard
String shouldRunFlag = SystemProperties.getString("jenkins.install.runSetupWizard");
boolean shouldRun = "true".equalsIgnoreCase(shouldRunFlag);
boolean shouldNotRun = "false".equalsIgnoreCase(shouldRunFlag);
-
+
// install wizard will always run if environment specified
if (!shouldRun) {
if (Functions.getIsUnitTest()) {
return InstallState.TEST;
}
-
+
if (SystemProperties.getBoolean("hudson.Main.development")) {
return InstallState.DEVELOPMENT;
}
@@ -161,7 +161,7 @@ private static InstallState getDefaultInstallState() {
// has the setup wizard been completed?
if (!SetupWizard.getUpdateStateFile().exists()) {
Jenkins j = Jenkins.get();
-
+
// Allow for skipping
if(shouldNotRun) {
InstallState.INITIAL_SETUP_COMPLETED.initializeState();
@@ -280,10 +280,10 @@ private static String getCurrentExecVersion() {
* Returns a list of any plugins that are persisted in the installing list
*/
@SuppressWarnings("unchecked")
- public static synchronized @CheckForNull Map getPersistedInstallStatus() {
+ public static synchronized @CheckForNull Map getPersistedInstallStatus() {
File installingPluginsFile = getInstallingPluginsFile();
if(installingPluginsFile == null || !installingPluginsFile.exists()) {
- return null;
+ return null;
}
return (Map)new XStream().fromXML(installingPluginsFile);
}
@@ -293,29 +293,29 @@ private static String getCurrentExecVersion() {
*/
public static synchronized void persistInstallStatus(List installingPlugins) {
File installingPluginsFile = getInstallingPluginsFile();
- if(installingPlugins == null || installingPlugins.isEmpty()) {
- try {
- Files.deleteIfExists(installingPluginsFile.toPath());
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
- return;
- }
- LOGGER.fine("Writing install state to: " + installingPluginsFile.getAbsolutePath());
- Map statuses = new HashMap<>();
- for(UpdateCenterJob j : installingPlugins) {
- if(j instanceof InstallationJob && j.getCorrelationId() != null) { // only include install jobs with a correlation id (directly selected)
- InstallationJob ij = (InstallationJob)j;
- InstallationStatus status = ij.status;
- String statusText = status.getType();
- if(status instanceof Installing) { // flag currently installing plugins as pending
- statusText = "Pending";
- }
- statuses.put(ij.plugin.name, statusText);
- }
- }
+ if(installingPlugins == null || installingPlugins.isEmpty()) {
+ try {
+ Files.deleteIfExists(installingPluginsFile.toPath());
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ return;
+ }
+ LOGGER.fine("Writing install state to: " + installingPluginsFile.getAbsolutePath());
+ Map statuses = new HashMap<>();
+ for(UpdateCenterJob j : installingPlugins) {
+ if(j instanceof InstallationJob && j.getCorrelationId() != null) { // only include install jobs with a correlation id (directly selected)
+ InstallationJob ij = (InstallationJob)j;
+ InstallationStatus status = ij.status;
+ String statusText = status.getType();
+ if(status instanceof Installing) { // flag currently installing plugins as pending
+ statusText = "Pending";
+ }
+ statuses.put(ij.plugin.name, statusText);
+ }
+ }
try {
- String installingPluginXml = new XStream().toXML(statuses);
+ String installingPluginXml = new XStream().toXML(statuses);
FileUtils.write(installingPluginsFile, installingPluginXml);
} catch (IOException e) {
LOGGER.log(SEVERE, "Failed to save " + installingPluginsFile.getAbsolutePath(), e);
@@ -325,7 +325,7 @@ public static synchronized void persistInstallStatus(List insta
/**
* Call to remove any active install status
*/
- public static void clearInstallStatus() {
- persistInstallStatus(null);
- }
+ public static void clearInstallStatus() {
+ persistInstallStatus(null);
+ }
}
diff --git a/core/src/main/java/jenkins/install/SetupWizard.java b/core/src/main/java/jenkins/install/SetupWizard.java
index feaa0c17e7e8..6e889cd772bb 100644
--- a/core/src/main/java/jenkins/install/SetupWizard.java
+++ b/core/src/main/java/jenkins/install/SetupWizard.java
@@ -78,7 +78,7 @@
/**
* A Jenkins instance used during first-run to provide a limited set of services while
* initial installation is in progress
- *
+ *
* @since 2.0
*/
@Restricted(NoExternalUse.class)
@@ -99,20 +99,20 @@ public SetupWizard() {
private static final String ADMIN_INITIAL_API_TOKEN_PROPERTY_NAME = SetupWizard.class.getName() + ".adminInitialApiToken";
/**
- * This property determines the behavior during the SetupWizard install phase concerning the API Token creation
+ * This property determines the behavior during the SetupWizard install phase concerning the API Token creation
* for the initial admin account.
* The behavior depends on the provided value:
* - true
- * A token is generated using random value at startup and the information is put
+ * A token is generated using random value at startup and the information is put
* in the file "$JENKINS_HOME/secrets/initialAdminApiToken".
- * - [2-char hash version][32-hex-char of secret], where the hash version is currently only 11.
+ * - [2-char hash version][32-hex-char of secret], where the hash version is currently only 11.
* E.g. 110123456789abcdef0123456789abcdef.
* A fixed API Token will be created for the user with that plain value as the token.
* It is strongly recommended to use it to generate a new one (random) and then revoke it.
* See {@link ApiTokenProperty#generateNewToken(String)} and {@link ApiTokenProperty#revokeAllTokensExceptOne(String)}
- * for scripting methods or using the web API calls:
- * /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/generateNewToken and
- * /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/revokeAllExcept
+ * for scripting methods or using the web API calls:
+ * /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/generateNewToken and
+ * /user/[user-login]/descriptorByName/jenkins.security.ApiTokenProperty/revokeAllExcept
* - @[file-location] where the file contains plain text value of the token, all stuff explained above is applicable
* The application will not delete the file after read, so the script is responsible to clean up the stuff
*
@@ -139,7 +139,7 @@ public String getDisplayName() {
*/
/*package*/ void init(boolean newInstall) throws IOException, InterruptedException {
Jenkins jenkins = Jenkins.get();
-
+
if(newInstall) {
// Create an admin user by default with a difficult password
FilePath iapf = getInitialAdminPasswordFile();
@@ -148,27 +148,27 @@ public String getDisplayName() {
HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(false, false, null);
jenkins.setSecurityRealm(securityRealm);
String randomUUID = UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.ENGLISH);
-
+
// create an admin user
User initialAdmin = securityRealm.createAccount(SetupWizard.initialSetupAdminUserName, randomUUID);
-
+
if (ADMIN_INITIAL_API_TOKEN != null) {
createInitialApiToken(initialAdmin);
}
-
+
// JENKINS-33599 - write to a file in the jenkins home directory
// most native packages of Jenkins creates a machine user account 'jenkins' to run Jenkins,
// and use group 'jenkins' for admins. So we allow groups to read this file
iapf.touch(System.currentTimeMillis());
iapf.chmod(0640);
iapf.write(randomUUID + System.lineSeparator(), "UTF-8");
-
-
+
+
// Lock Jenkins down:
FullControlOnceLoggedInAuthorizationStrategy authStrategy = new FullControlOnceLoggedInAuthorizationStrategy();
authStrategy.setAllowAnonymousRead(false);
jenkins.setAuthorizationStrategy(authStrategy);
-
+
// Disable jnlp by default, but honor system properties
jenkins.setSlaveAgentPort(SystemProperties.getInteger(Jenkins.class.getName()+".slaveAgentPort",-1));
@@ -179,7 +179,7 @@ public String getDisplayName() {
bc.commit();
}
}
-
+
if(iapf.exists()) {
String setupKey = iapf.readToString().trim();
String ls = System.lineSeparator();
@@ -276,7 +276,7 @@ private void tearDownFilter() {
throw new RuntimeException("Unable to remove PluginServletFilter for the SetupWizard", e);
}
}
-
+
/**
* Indicates a generated password should be used - e.g. this is a new install, no security realm set up
*/
@@ -370,7 +370,7 @@ public HttpResponse doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) t
Authentication auth = new UsernamePasswordAuthenticationToken(newUser.getId(), req.getParameter("password1"));
auth = securityRealm.getSecurityComponents().manager2.authenticate(auth);
SecurityContextHolder.getContext().setAuthentication(auth);
-
+
HttpSession session = req.getSession(false);
if (session != null) {
// avoid session fixation
@@ -382,7 +382,7 @@ public HttpResponse doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) t
String sessionSeed = userSeed.getSeed();
// include the new seed
newSession.setAttribute(UserSeedProperty.USER_SESSION_SEED, sessionSeed);
-
+
CrumbIssuer crumbIssuer = Jenkins.get().getCrumbIssuer();
JSONObject data = new JSONObject();
if (crumbIssuer != null) {
@@ -402,28 +402,28 @@ public HttpResponse doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) t
admin.save(); // recreate this initial user if something failed
}
}
- }
-
+ }
+
@POST
@Restricted(NoExternalUse.class)
public HttpResponse doConfigureInstance(StaplerRequest req, @QueryParameter String rootUrl) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
-
+
Map errors = new HashMap<>();
// pre-check data
checkRootUrl(errors, rootUrl);
-
+
if(!errors.isEmpty()){
return HttpResponses.errorJSON(Messages.SetupWizard_ConfigureInstance_ValidationErrors(), errors);
}
-
+
// use the parameters to configure the instance
useRootUrl(errors, rootUrl);
-
+
if(!errors.isEmpty()){
return HttpResponses.errorJSON(Messages.SetupWizard_ConfigureInstance_ValidationErrors(), errors);
}
-
+
InstallUtil.proceedToNextStateFrom(InstallState.CONFIGURE_INSTANCE);
CrumbIssuer crumbIssuer = Jenkins.get().getCrumbIssuer();
@@ -433,7 +433,7 @@ public HttpResponse doConfigureInstance(StaplerRequest req, @QueryParameter Stri
}
return HttpResponses.okJSON(data);
}
-
+
private void checkRootUrl(Map errors, @CheckForNull String rootUrl){
if(rootUrl == null){
errors.put("rootUrl", Messages.SetupWizard_ConfigureInstance_RootUrl_Empty());
@@ -443,7 +443,7 @@ private void checkRootUrl(Map errors, @CheckForNull String rootU
errors.put("rootUrl", Messages.SetupWizard_ConfigureInstance_RootUrl_Invalid());
}
}
-
+
private void useRootUrl(Map errors, @CheckForNull String rootUrl){
LOGGER.log(Level.FINE, "Root URL set during SetupWizard to {0}", new Object[]{ rootUrl });
JenkinsLocationConfiguration.getOrDie().setUrl(rootUrl);
@@ -452,7 +452,7 @@ private void useRootUrl(Map errors, @CheckForNull String rootUrl
/*package*/ void setCurrentLevel(VersionNumber v) throws IOException {
FileUtils.writeStringToFile(getUpdateStateFile(), v.toString(), StandardCharsets.UTF_8);
}
-
+
/**
* File that captures the state of upgrade.
*
@@ -461,7 +461,7 @@ private void useRootUrl(Map errors, @CheckForNull String rootUrl
/*package*/ static File getUpdateStateFile() {
return new File(Jenkins.get().getRootDir(),"jenkins.install.UpgradeWizard.state");
}
-
+
/**
* What is the version the upgrade wizard has run the last time and upgraded to?.
* If {@link #getUpdateStateFile()} is missing, presumes the baseline is 1.0
@@ -482,7 +482,7 @@ public VersionNumber getCurrentLevel() {
}
return from;
}
-
+
/**
* Returns the initial plugin list in JSON format
*/
@@ -504,7 +504,7 @@ public HttpResponse doPlatformPluginList() throws IOException {
}
return HttpResponses.okJSON();
}
-
+
/**
* Returns whether the system needs a restart, and if it is supported
* e.g. { restartRequired: true, restartSupported: false }
@@ -531,7 +531,7 @@ public JSONArray getPlatformPluginUpdates() {
}
return getPlatformPluginsForUpdate(version, Jenkins.getVersion());
}
-
+
/**
* Gets the suggested plugin list from the update sites, falling back to a local version
* @return JSON array with the categorized plugin list
@@ -551,7 +551,7 @@ public JSONArray getPlatformPluginUpdates() {
}
try {
URLConnection connection = ProxyConfiguration.open(new URL(suggestedPluginUrl));
-
+
try {
String initialPluginJson = IOUtils.toString(connection.getInputStream(), StandardCharsets.UTF_8);
@@ -624,7 +624,7 @@ public JSONArray getPlatformPluginUpdates() {
if (category instanceof JSONObject) {
JSONObject cat = (JSONObject)category;
JSONArray plugins = cat.getJSONArray("plugins");
-
+
nextPlugin: for (Iterator> pluginIterator = plugins.iterator(); pluginIterator.hasNext();) {
Object pluginData = pluginIterator.next();
if (pluginData instanceof JSONObject) {
@@ -658,10 +658,10 @@ public JSONArray getPlatformPluginUpdates() {
}
}
}
-
+
pluginIterator.remove();
}
-
+
if (plugins.isEmpty()) {
categoryIterator.remove();
}
@@ -676,7 +676,7 @@ public JSONArray getPlatformPluginUpdates() {
public FilePath getInitialAdminPasswordFile() {
return Jenkins.get().getRootPath().child("secrets/initialAdminPassword");
}
-
+
/**
* Gets the file used to store the initial admin API Token, in case the system property
* {@link #ADMIN_INITIAL_API_TOKEN} is set to "true" (and only in this case).
@@ -694,21 +694,21 @@ public HttpResponse doCompleteInstall() throws IOException, ServletException {
completeSetup();
return HttpResponses.okJSON();
}
-
+
/*package*/ void completeSetup() throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
InstallUtil.saveLastExecVersion();
setCurrentLevel(Jenkins.getVersion());
InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_SETUP_COMPLETED);
}
-
+
/**
* Gets all the install states
*/
public List getInstallStates() {
return InstallState.all();
}
-
+
/**
* Returns an installState by name
*/
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index b6eccb039b37..b89ed1e16334 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -370,9 +370,9 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
@Deprecated
private InstallState installState;
-
+
/**
- * If we're in the process of an initial setup,
+ * If we're in the process of an initial setup,
* this will be set
*/
private transient SetupWizard setupWizard;
@@ -891,7 +891,6 @@ protected Jenkins(File root, ServletContext context) throws IOException, Interru
* If non-null, use existing plugin manager. create a new one.
*/
@SuppressFBWarnings({
- "DMI_RANDOM_USED_ONLY_ONCE", // TODO needs triage
"ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", // Trigger.timer
"DM_EXIT" // Exit is wanted here
})
@@ -934,9 +933,8 @@ protected Jenkins(File root, ServletContext context, PluginManager pluginManager
if(secretFile.exists()) {
secretKey = secretFile.readTrim();
} else {
- SecureRandom sr = new SecureRandom();
byte[] random = new byte[32];
- sr.nextBytes(random);
+ RANDOM.nextBytes(random);
secretKey = Util.toHexString(random);
secretFile.write(secretKey);
@@ -1093,7 +1091,7 @@ public ProxyConfiguration getProxy() {
/**
* Set the proxy configuration.
- *
+ *
* @param proxy the proxy to set
* @since 2.205
*/
@@ -1116,7 +1114,7 @@ public InstallState getInstallState() {
}
/**
- * Update the current install state. This will invoke state.initializeState()
+ * Update the current install state. This will invoke state.initializeState()
* when the state has been transitioned.
*/
public void setInstallState(@NonNull InstallState newState) {
@@ -1658,11 +1656,11 @@ Descriptor findDescriptor(String shortClassName, Collection extends Descrip
}
protected void updateNewComputer(Node n) {
- updateNewComputer(n, AUTOMATIC_SLAVE_LAUNCH);
+ updateNewComputer(n, AUTOMATIC_AGENT_LAUNCH);
}
protected void updateComputerList() {
- updateComputerList(AUTOMATIC_SLAVE_LAUNCH);
+ updateComputerList(AUTOMATIC_AGENT_LAUNCH);
}
/** @deprecated Use {@link SCMListener#all} instead. */
@@ -2425,7 +2423,7 @@ public String getUrlChildPrefix() {
* It is done in this order so that it can work correctly even in the face
* of a reverse proxy.
*
- * @return {@code null} if this parameter is not configured by the user and the calling thread is not in an HTTP request;
+ * @return {@code null} if this parameter is not configured by the user and the calling thread is not in an HTTP request;
* otherwise the returned URL will always have the trailing {@code /}
* @throws IllegalStateException {@link JenkinsLocationConfiguration} cannot be retrieved.
* Jenkins instance may be not ready, or there is an extension loading glitch.
@@ -3951,7 +3949,7 @@ public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp
boolean result = true;
for (Descriptor> d : Functions.getSortedDescriptorsForGlobalConfigUnclassified())
result &= configureDescriptor(req,json,d);
-
+
save();
updateComputerList();
if(result)
@@ -4201,7 +4199,7 @@ public static void checkGoodName(String name) throws Failure {
throw new Failure(Messages.Hudson_TrailingDot());
}
}
-
+
// looks good
}
@@ -4940,7 +4938,7 @@ public Map> getCategorizedManageme
}
return byCategory;
}
-
+
/**
* If set, a currently active setup wizard - e.g. installation
*
@@ -4950,7 +4948,7 @@ public Map> getCategorizedManageme
public SetupWizard getSetupWizard() {
return setupWizard;
}
-
+
/**
* Exposes the current user to {@code /me} URL.
*/
@@ -4986,7 +4984,7 @@ public Object getTarget() {
}
return this;
}
-
+
/**
* Test a path to see if it is subject to mandatory read permission checks by container-managed security
* @param restOfPath the URI, excluding the Jenkins root URI and query string
@@ -5307,7 +5305,7 @@ private static void computeVersion(ServletContext context) {
LOGGER.log(WARNING, e, () -> "Unable to read Jenkins version: " + e.getMessage());
}
}
-
+
VERSION = ver;
context.setAttribute("version",ver);
@@ -5463,9 +5461,9 @@ public boolean shouldShowStackTrace() {
* Name of the system property escape hatch for SECURITY-2424. It allows to have back the legacy (and vulnerable)
* behavior allowing a "good name" to end with a dot. This could be used to exploit two names colliding in the file
* system to extract information. The files ending with a dot are only a problem on Windows.
- *
+ *
* The default value is true.
- *
+ *
* For detailed documentation: https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/file-folder-name-whitespace-characters
* @see #checkGoodName(String)
*/
@@ -5505,10 +5503,11 @@ public boolean shouldShowStackTrace() {
/**
* Automatically try to launch an agent when Jenkins is initialized or a new agent computer is created.
*/
- @SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "TODO needs triage")
- public static boolean AUTOMATIC_SLAVE_LAUNCH = true;
+ @SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "for script console")
+ public static boolean AUTOMATIC_AGENT_LAUNCH = SystemProperties.getBoolean(Jenkins.class.getName() + ".automaticAgentLaunch", true);
private static final Logger LOGGER = Logger.getLogger(Jenkins.class.getName());
+ private static final SecureRandom RANDOM = new SecureRandom();
public static final PermissionGroup PERMISSIONS = Permission.HUDSON_PERMISSIONS;
public static final Permission ADMINISTER = Permission.HUDSON_ADMINISTER;
diff --git a/core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java b/core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java
index 89d2b6e60cf0..b9ca47c2d2d0 100644
--- a/core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java
+++ b/core/src/main/java/jenkins/model/JenkinsLocationConfiguration.java
@@ -48,7 +48,7 @@ public class JenkinsLocationConfiguration extends GlobalConfiguration implements
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Accessible via System Groovy Scripts")
public static /* not final */ boolean DISABLE_URL_VALIDATION =
SystemProperties.getBoolean(JenkinsLocationConfiguration.class.getName() + ".disableUrlValidation");
-
+
@Restricted(NoExternalUse.class)
public static final int ORDINAL = 200;
@@ -66,7 +66,7 @@ public class JenkinsLocationConfiguration extends GlobalConfiguration implements
public static @NonNull JenkinsLocationConfiguration get() {
return GlobalConfiguration.all().getInstance(JenkinsLocationConfiguration.class);
}
-
+
/**
* Gets local configuration. For explanation when it could die, see {@link #get()}
*/
diff --git a/core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java b/core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
index 9c43d68a3411..20531cc55418 100644
--- a/core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
+++ b/core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
@@ -22,6 +22,8 @@
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.XMLOutput;
+import org.jenkins.ui.icon.Icon;
+import org.jenkins.ui.icon.IconSet;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.stapler.HttpResponse;
@@ -162,7 +164,7 @@ public ContextMenu add(Node n) {
Computer c = n.toComputer();
return add(new MenuItem()
.withDisplayName(n.getDisplayName())
- .withStockIcon(c == null ? "computer.png" : c.getIcon())
+ .withIconClass(c == null ? "icon-computer" : c.getIconClassName())
.withContextRelativeUrl(n.getSearchUrl()));
}
@@ -174,7 +176,7 @@ public ContextMenu add(Node n) {
public ContextMenu add(Computer c) {
return add(new MenuItem()
.withDisplayName(c.getDisplayName())
- .withStockIcon(c.getIcon())
+ .withIconClass(c.getIconClassName())
.withContextRelativeUrl(c.getUrl()));
}
@@ -339,7 +341,13 @@ public MenuItem withIcon(BallColor color) {
* String like "gear.png" that resolves to 24x24 stock icon in the core
*/
public MenuItem withStockIcon(String icon) {
- this.icon = Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH + "/images/24x24/"+icon;
+ this.icon = getResourceUrl() + "/images/24x24/" + icon;
+ return this;
+ }
+
+ public MenuItem withIconClass(String iconClass) {
+ Icon iconByClass = IconSet.icons.getIconByClassSpec(iconClass + " icon-md");
+ this.icon = iconByClass == null ? null : iconByClass.getQualifiedUrl(getResourceUrl());
return this;
}
@@ -351,6 +359,11 @@ public MenuItem withDisplayName(String displayName) {
public MenuItem withDisplayName(ModelObject o) {
return withDisplayName(o.getDisplayName());
}
+
+ private String getResourceUrl() {
+ return Stapler.getCurrentRequest().getContextPath() + Jenkins.RESOURCE_PATH;
+ }
+
}
/**
diff --git a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
index 0752b0bcc250..7c87af7924c0 100644
--- a/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
+++ b/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
@@ -92,7 +92,7 @@
*/
@SuppressWarnings("unchecked") // AbstractItem.getParent does not correctly override; scheduleBuild2 inherently untypable
public abstract class ParameterizedJobMixIn & ParameterizedJobMixIn.ParameterizedJob & Queue.Task, RunT extends Run & Queue.Executable> {
-
+
protected abstract JobT asJob();
/** @see BuildableItem#scheduleBuild() */
diff --git a/core/src/main/java/jenkins/model/item_category/ItemCategory.java b/core/src/main/java/jenkins/model/item_category/ItemCategory.java
index 520c98090fa1..d4443273a330 100644
--- a/core/src/main/java/jenkins/model/item_category/ItemCategory.java
+++ b/core/src/main/java/jenkins/model/item_category/ItemCategory.java
@@ -25,10 +25,10 @@
package jenkins.model.item_category;
import edu.umd.cs.findbugs.annotations.NonNull;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
+import hudson.RestrictedSince;
import hudson.model.TopLevelItemDescriptor;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -47,8 +47,8 @@ public abstract class ItemCategory implements ExtensionPoint {
* See JENKINS-36593 for more info.
*/
@Restricted(NoExternalUse.class)
- @SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "TODO needs triage")
- public static int MIN_TOSHOW = 1;
+ @RestrictedSince("2.14")
+ public static final int MIN_TOSHOW = 1;
/**
* Helpful to set the order.
diff --git a/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java b/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
index 24be3366bf3c..91e6cf224b69 100644
--- a/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
+++ b/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
@@ -247,7 +247,7 @@ public boolean contains(Object v) {
/**
* Historical holder for map.
- *
+ *
* TODO all this mess including {@link #numberOnDisk} could probably be simplified to a single {@code TreeMap>}
* where a null value means not yet loaded and a broken entry just uses {@code NoHolder}.
*
@@ -317,7 +317,7 @@ public final boolean baseDirInitialized() {
public final void updateBaseDir(File dir) {
this.dir = dir;
}
-
+
/**
* Let go of all the loaded references.
*
@@ -625,7 +625,7 @@ private Index copy() {
/**
* Tries to load the record #N.
- *
+ *
* @return null if the data failed to load.
*/
private R load(int n, Index editInPlace) {
diff --git a/core/src/main/java/jenkins/security/UserDetailsCache.java b/core/src/main/java/jenkins/security/UserDetailsCache.java
index b03f5c0da5e3..12538a1da742 100644
--- a/core/src/main/java/jenkins/security/UserDetailsCache.java
+++ b/core/src/main/java/jenkins/security/UserDetailsCache.java
@@ -64,13 +64,15 @@ public final class UserDetailsCache {
@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "field is static for script console")
public UserDetailsCache() {
- if (EXPIRE_AFTER_WRITE_SEC == null || EXPIRE_AFTER_WRITE_SEC <= 0) {
+ Integer expireAfterWriteSec = EXPIRE_AFTER_WRITE_SEC;
+ if (expireAfterWriteSec == null || expireAfterWriteSec <= 0) {
//just in case someone is trying to trick us
- EXPIRE_AFTER_WRITE_SEC = SystemProperties.getInteger(SYS_PROP_NAME, (int)TimeUnit.MINUTES.toSeconds(2));
- if (EXPIRE_AFTER_WRITE_SEC <= 0) {
+ expireAfterWriteSec = SystemProperties.getInteger(SYS_PROP_NAME, (int)TimeUnit.MINUTES.toSeconds(2));
+ if (expireAfterWriteSec <= 0) {
//The property could also be set to a negative value
- EXPIRE_AFTER_WRITE_SEC = (int)TimeUnit.MINUTES.toSeconds(2);
+ expireAfterWriteSec = (int)TimeUnit.MINUTES.toSeconds(2);
}
+ EXPIRE_AFTER_WRITE_SEC = expireAfterWriteSec;
}
detailsCache = CacheBuilder.newBuilder().softValues().expireAfterWrite(EXPIRE_AFTER_WRITE_SEC, TimeUnit.SECONDS).build();
existenceCache = CacheBuilder.newBuilder().softValues().expireAfterWrite(EXPIRE_AFTER_WRITE_SEC, TimeUnit.SECONDS).build();
diff --git a/core/src/main/java/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor.java b/core/src/main/java/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor.java
index 18827c94fdbd..20c9d27e1b10 100644
--- a/core/src/main/java/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor.java
+++ b/core/src/main/java/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor.java
@@ -161,7 +161,12 @@ public boolean hasMoreRecentlyUsedToken(@NonNull User user, ApiTokenProperty.Tok
}
@RequirePOST
- @SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "written to by Stapler")
+ @SuppressFBWarnings(
+ value = {
+ "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
+ "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"
+ },
+ justification = "written to by Stapler")
public HttpResponse doRevokeAllSelected(@JsonBody RevokeAllSelectedModel content) throws IOException {
for (RevokeAllSelectedUserAndUuid value : content.values) {
if (value.userId == null) {
diff --git a/core/src/main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java b/core/src/main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java
index f4c4e71387c0..1f1f75c6f01a 100644
--- a/core/src/main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java
+++ b/core/src/main/java/jenkins/slaves/EncryptedSlaveAgentJnlpFile.java
@@ -1,6 +1,5 @@
package jenkins.slaves;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Util;
import hudson.security.AccessControlled;
import hudson.security.Permission;
@@ -40,6 +39,7 @@
public class EncryptedSlaveAgentJnlpFile implements HttpResponse {
private static final Logger LOG = Logger.getLogger(EncryptedSlaveAgentJnlpFile.class.getName());
+ private static final SecureRandom RANDOM = new SecureRandom();
/**
* The object that owns the Jelly view that renders JNLP file.
@@ -69,7 +69,6 @@ public EncryptedSlaveAgentJnlpFile(AccessControlled it, String viewName, String
this.slaveName = slaveName;
}
- @SuppressFBWarnings(value = "DMI_RANDOM_USED_ONLY_ONCE", justification = "TODO needs triage")
@Override
public void generateResponse(StaplerRequest req, final StaplerResponse res, Object node) throws IOException, ServletException {
RequestDispatcher view = req.getView(it, viewName);
@@ -86,7 +85,7 @@ public void generateResponse(StaplerRequest req, final StaplerResponse res, Obje
view.forward(req, temp);
byte[] iv = new byte[128/8];
- new SecureRandom().nextBytes(iv);
+ RANDOM.nextBytes(iv);
byte[] jnlpMac;
if(it instanceof SlaveComputer) {
diff --git a/core/src/main/java/jenkins/util/ProgressiveRendering.java b/core/src/main/java/jenkins/util/ProgressiveRendering.java
index 3a29ea71ab09..3bfbf2cf82b2 100644
--- a/core/src/main/java/jenkins/util/ProgressiveRendering.java
+++ b/core/src/main/java/jenkins/util/ProgressiveRendering.java
@@ -102,7 +102,6 @@ protected ProgressiveRendering() {
/**
* For internal use.
*/
- @SuppressWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
@JavaScriptMethod public final void start() {
Ancestor ancestor = Stapler.getCurrentRequest().findAncestor(BoundObjectTable.class);
if (ancestor == null) {
diff --git a/core/src/main/java/jenkins/util/SystemProperties.java b/core/src/main/java/jenkins/util/SystemProperties.java
index bb1b51fc47d3..5e6381d5e29b 100644
--- a/core/src/main/java/jenkins/util/SystemProperties.java
+++ b/core/src/main/java/jenkins/util/SystemProperties.java
@@ -87,6 +87,7 @@ private interface Handler {
private static final Handler NULL_HANDLER = key -> null;
+ @SuppressFBWarnings(value = "NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", justification = "the field is initialized by a static initializer, not a constructor")
private static @NonNull Handler handler = NULL_HANDLER;
// declared in WEB-INF/web.xml
diff --git a/core/src/main/java/jenkins/util/TreeString.java b/core/src/main/java/jenkins/util/TreeString.java
index b9970b60f665..fb60151aa405 100644
--- a/core/src/main/java/jenkins/util/TreeString.java
+++ b/core/src/main/java/jenkins/util/TreeString.java
@@ -43,8 +43,6 @@
* @author Kohsuke Kawaguchi
* @since 1.473
*/
-// CHECKSTYLE:OFF
-@SuppressWarnings("PMD")
public final class TreeString implements Serializable {
private static final long serialVersionUID = 3621959682117480904L;
@@ -191,7 +189,6 @@ public static TreeString of(final String s) {
* Default {@link Converter} implementation for XStream that does interning
* scoped to one unmarshalling.
*/
- @SuppressWarnings("all")
public static final class ConverterImpl implements Converter {
public ConverterImpl(final XStream xs) {}
diff --git a/core/src/main/java/jenkins/util/TreeStringBuilder.java b/core/src/main/java/jenkins/util/TreeStringBuilder.java
index 78effcb5f570..a04dc638e332 100644
--- a/core/src/main/java/jenkins/util/TreeStringBuilder.java
+++ b/core/src/main/java/jenkins/util/TreeStringBuilder.java
@@ -20,8 +20,6 @@
* @author Kohsuke Kawaguchi
* @since 1.473
*/
-@SuppressWarnings({"PMD", "all"})
-//CHECKSTYLE:OFF
public class TreeStringBuilder {
Child root = new Child(new TreeString());
diff --git a/core/src/main/java/jenkins/views/FullHeader.java b/core/src/main/java/jenkins/views/FullHeader.java
index aef4537bdbf0..1ede5645dff4 100644
--- a/core/src/main/java/jenkins/views/FullHeader.java
+++ b/core/src/main/java/jenkins/views/FullHeader.java
@@ -3,13 +3,13 @@
/**
* {@link Header} that provides its own resources as full replacement. It does not
* depends on any core resource (images, CSS, JS, etc.)
- *
+ *
* Given this kind of header is totally independent, it will be compatible by default.
- *
+ *
* @see Header
*/
public abstract class FullHeader extends Header {
-
+
public boolean isCompatible() {
return true;
}
diff --git a/core/src/main/java/org/jenkins/ui/icon/Icon.java b/core/src/main/java/org/jenkins/ui/icon/Icon.java
index 3162ea222c2c..616e60d1076f 100644
--- a/core/src/main/java/org/jenkins/ui/icon/Icon.java
+++ b/core/src/main/java/org/jenkins/ui/icon/Icon.java
@@ -179,7 +179,23 @@ public String getUrl() {
*/
public String getQualifiedUrl(JellyContext context) {
if (url != null) {
- return iconType.toQualifiedUrl(url, context);
+ return iconType.toQualifiedUrl(url, context.getVariable("resURL").toString());
+ } else {
+ return "";
+ }
+ }
+
+ /**
+ * Get the qualified icon url.
+ *
+ * Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon.
+ *
+ * @param resUrl The url of resources.
+ * @return The qualified icon url.
+ */
+ public String getQualifiedUrl(String resUrl) {
+ if (url != null) {
+ return iconType.toQualifiedUrl(url, resUrl);
} else {
return "";
}
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 54b2cdba3331..462b0ee1f2a9 100644
--- a/core/src/main/java/org/jenkins/ui/icon/IconType.java
+++ b/core/src/main/java/org/jenkins/ui/icon/IconType.java
@@ -23,8 +23,6 @@
*/
package org.jenkins.ui.icon;
-import org.apache.commons.jelly.JellyContext;
-
/**
* Icon type.
*
@@ -41,11 +39,10 @@ public enum IconType {
* Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon.
*
* @param url The url to be qualified.
- * @param context The JellyContext.
+ * @param resURL The url of resources.
* @return The qualified icon url.
*/
- public String toQualifiedUrl(String url, JellyContext context) {
- String resURL = context.getVariable("resURL").toString();
+ public String toQualifiedUrl(String url, String resURL) {
switch (this) {
case CORE: {
diff --git a/core/src/main/resources/hudson/logging/Messages.properties b/core/src/main/resources/hudson/logging/Messages.properties
index 2ec0a4891708..cdac5ab4f965 100644
--- a/core/src/main/resources/hudson/logging/Messages.properties
+++ b/core/src/main/resources/hudson/logging/Messages.properties
@@ -22,3 +22,5 @@
LogRecorderManager.init=Initializing log recorders
LogRecorderManager.DisplayName=System Log
+LogRecorderManager.LoggerNotFound=A logger named "{0}" does not exist. \
+ Add a logger by this name to a log recorder before attempting to configure its level.
diff --git a/core/src/main/resources/lib/hudson/executors.jelly b/core/src/main/resources/lib/hudson/executors.jelly
index c63b0210aca2..440fe18d0f4e 100644
--- a/core/src/main/resources/lib/hudson/executors.jelly
+++ b/core/src/main/resources/lib/hudson/executors.jelly
@@ -39,10 +39,10 @@ THE SOFTWARE.
- ( ${%offline})
+ ( ${%offline})
- (${%launching})
+ (${%launching})
(${%offline})
diff --git a/core/src/test/java/hudson/FilePathTest.java b/core/src/test/java/hudson/FilePathTest.java
index 3b644e7f3dfe..eb42d487fb8f 100644
--- a/core/src/test/java/hudson/FilePathTest.java
+++ b/core/src/test/java/hudson/FilePathTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Alan Harder
- *
+ *
* 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
@@ -140,9 +140,9 @@ public class FilePathTest {
final File tmp = temp.newFile();
int fileSize = 90000;
-
+
givenSomeContentInFile(tmp, fileSize);
-
+
List> results = whenFileIsCopied100TimesConcurrently(tmp);
// THEN copied count was always equal the expected size
@@ -158,7 +158,7 @@ private void givenSomeContentInFile(File file, int size) throws IOException {
os.write(buf);
}
}
-
+
private List> whenFileIsCopied100TimesConcurrently(final File file) throws InterruptedException {
List> r = new ArrayList<>();
for (int i=0; i<100; i++) {
@@ -342,17 +342,17 @@ private FilePath createFilePath(final File base, final String... path) throws IO
FileUtils.touch(building);
return new FilePath(building);
}
-
+
/**
* Performs round-trip archiving for Tar handling methods.
* @throws Exception test failure
*/
@Test public void compressTarUntarRoundTrip() throws Exception {
- checkTarUntarRoundTrip("compressTarUntarRoundTrip_zero", 0);
- checkTarUntarRoundTrip("compressTarUntarRoundTrip_small", 100);
- checkTarUntarRoundTrip("compressTarUntarRoundTrip_medium", 50000);
+ checkTarUntarRoundTrip("compressTarUntarRoundTrip_zero", 0);
+ checkTarUntarRoundTrip("compressTarUntarRoundTrip_small", 100);
+ checkTarUntarRoundTrip("compressTarUntarRoundTrip_medium", 50000);
}
-
+
/**
* Checks that big files (greater than 8GB) can be archived and then unpacked.
* This test is disabled by default due the impact on RAM.
@@ -366,7 +366,7 @@ private FilePath createFilePath(final File base, final String... path) throws IO
final String filePrefix = "JENKINS-10629";
checkTarUntarRoundTrip(filePrefix, largeFileSize);
}
-
+
private void checkTarUntarRoundTrip(String filePrefix, long fileSize) throws Exception {
final File tmpDir = temp.newFolder(filePrefix);
final File tempFile = new File(tmpDir, filePrefix + ".log");
@@ -436,13 +436,13 @@ private void checkTarUntarRoundTrip(String filePrefix, long fileSize) throws Exc
FilePath middle = new FilePath(base, "jdk/jdk1.6.0_21/label/sqlserver/profile/sqlserver");
FilePath full = new FilePath(middle, "acceptance-tests\\distribution.zip");
assertFalse(full.isUnix());
-
-
+
+
FilePath unixPath = new FilePath(dummy,
"/home/test");
assertTrue(unixPath.isUnix());
}
-
+
/**
* Tests that permissions are kept when using {@link FilePath#copyToWithPermission(FilePath)}.
* Also tries to check that a problem with setting the last-modified date on Windows doesn't fail the whole copy
@@ -453,21 +453,21 @@ private void checkTarUntarRoundTrip(String filePrefix, long fileSize) throws Exc
File child = new File(tmp,"child");
FilePath childP = new FilePath(child);
childP.touch(4711);
-
+
Chmod chmodTask = new Chmod();
chmodTask.setProject(new Project());
chmodTask.setFile(child);
chmodTask.setPerm("0400");
chmodTask.execute();
-
+
FilePath copy = new FilePath(channels.british, tmp.getPath()).child("copy");
childP.copyToWithPermission(copy);
-
+
assertEquals(childP.mode(),copy.mode());
if (!Functions.isWindows()) {
assertEquals(childP.lastModified(),copy.lastModified());
}
-
+
// JENKINS-11073:
// Windows seems to have random failures when setting the timestamp on newly generated
// files. So test that:
@@ -504,7 +504,7 @@ private void checkTarUntarRoundTrip(String filePrefix, long fileSize) throws Exc
in.mkdirs();
in.child("c").touch(0);
in.child("b").symlinkTo("c", TaskListener.NULL);
-
+
FilePath tar = tmp.child("test.tar");
in.tar(tar.write(), "**/*");
@@ -566,7 +566,7 @@ private static void assertValidateAntFileMask(String expected, FilePath d, Strin
assertEquals(Messages.FilePath_validateAntFileMask_portionMatchButPreviousNotMatchAndSuggest("**/*.js", "**", "**/*.js"), d.validateAntFileMask("**/*.js", 1000));
assertThrows(InterruptedException.class, () -> d.validateAntFileMask("**/*.js", 10));
}
-
+
@Issue("JENKINS-5253")
@Test public void testValidateCaseSensitivity() throws Exception {
File tmp = Util.createTempDir();
@@ -585,27 +585,27 @@ private static void assertValidateAntFileMask(String expected, FilePath d, Strin
Util.deleteRecursive(tmp);
}
}
-
+
@Issue("JENKINS-15418")
@Test public void deleteLongPathOnWindows() throws Exception {
File tmp = temp.getRoot();
FilePath d = new FilePath(channels.french, tmp.getPath());
-
+
// construct a very long path
StringBuilder sb = new StringBuilder();
while(sb.length() + tmp.getPath().length() < 260 - "very/".length()) {
sb.append("very/");
}
sb.append("pivot/very/very/long/path");
-
- FilePath longPath = d.child(sb.toString());
+
+ FilePath longPath = d.child(sb.toString());
longPath.mkdirs();
FilePath childInLongPath = longPath.child("file.txt");
childInLongPath.touch(0);
-
+
File firstDirectory = new File(tmp.getAbsolutePath() + "/very");
Util.deleteRecursive(firstDirectory);
-
+
assertFalse("Could not delete directory!", firstDirectory.exists());
}
@@ -723,7 +723,7 @@ private InputStream someZippedContent() throws IOException {
final FilePath src = new FilePath(sub);
final FilePath dst = new FilePath(top);
-
+
// test conflict subdir
src.moveAllChildrenTo(dst);
}
@@ -828,7 +828,7 @@ public void deleteSuffixesRecursive() throws Exception {
FilePath textTempFile = suffix.createTextTempFile("tmp", null, "dummy", true);
assertThat(textTempFile.exists(), is(true));
-
+
filePath.deleteSuffixesRecursive();
assertThat(textTempFile.exists(), is(false));
}
diff --git a/core/src/test/java/hudson/FunctionsTest.java b/core/src/test/java/hudson/FunctionsTest.java
index 5309f87068aa..3342c30ccac4 100644
--- a/core/src/test/java/hudson/FunctionsTest.java
+++ b/core/src/test/java/hudson/FunctionsTest.java
@@ -124,7 +124,7 @@ public void testGetActionUrl_relativePath() {
}
}
}
-
+
@Test
public void testGetRelativeLinkTo_JobContainedInView() {
String contextPath = "/jenkins";
@@ -187,9 +187,9 @@ public void testGetRelativeLinkTo_JobNotContainedInView() {
assertEquals("/jenkins/job/i/", result);
}
}
-
+
private interface TopLevelItemAndItemGroup extends TopLevelItem, ItemGroup, ViewGroup {}
-
+
@Test
public void testGetRelativeLinkTo_JobContainedInViewWithinItemGroup() {
String contextPath = "/jenkins";
@@ -240,7 +240,7 @@ public void testGetRelativeDisplayName() {
when(i.getFullDisplayName()).thenReturn("displayName");
assertEquals("displayName",Functions.getRelativeDisplayNameFrom(i, null));
}
-
+
@Test
public void testGetRelativeDisplayNameInsideItemGroup() {
Item i = mock(Item.class);
@@ -265,7 +265,7 @@ private void createMockAncestors(StaplerRequest req, Ancestor... ancestors) {
List ancestorsList = Arrays.asList(ancestors);
when(req.getAncestors()).thenReturn(ancestorsList);
}
-
+
private TopLevelItem createMockItem(ItemGroup p, String shortUrl) {
return createMockItem(p, shortUrl, shortUrl);
}
@@ -283,7 +283,7 @@ private Jenkins createMockJenkins(MockedStatic mockedJenkins) {
mockedJenkins.when(Jenkins::get).thenReturn(j);
return j;
}
-
+
private static Ancestor createAncestor(Object o, String relativePath) {
Ancestor a = mock(Ancestor.class);
when(a.getObject()).thenReturn(o);
diff --git a/core/src/test/java/hudson/PluginManagerTest.java b/core/src/test/java/hudson/PluginManagerTest.java
index 9fcb0310d55d..71161bb9490d 100644
--- a/core/src/test/java/hudson/PluginManagerTest.java
+++ b/core/src/test/java/hudson/PluginManagerTest.java
@@ -87,42 +87,42 @@ public void parseInvalidRequestedPlugins() throws Exception {
assertThat(ex.getCause(), instanceOf(SAXException.class));
assertThat(ex.getCause().getMessage(), containsString("DOCTYPE is disallowed"));
}
-
+
@Test
public void shouldProperlyParseManifestFromJar() throws IOException {
File jar = createHpiWithManifest();
final Manifest manifest = PluginManager.parsePluginManifest(jar.toURI().toURL());
-
+
assertThat("manifest should have been read from the sample", manifest, notNullValue());
assertAttribute(manifest, "Created-By", "Apache Maven");
assertAttribute(manifest, "Short-Name", "matrix-auth");
-
+
// Multi-line entries
assertAttribute(manifest, "Specification-Title", "Offers matrix-based security authorization strategies (global and per-project).");
assertAttribute(manifest, "Url", "http://wiki.jenkins-ci.org/display/JENKINS/Matrix+Authorization+Strategy+Plugin");
-
+
// Empty field
assertAttribute(manifest, "Plugin-Developers", null);
}
-
+
@Test
public void shouldProperlyRetrieveModificationDate() throws IOException {
File jar = createHpiWithManifest();
URL url = toManifestUrl(jar);
- assertThat("Manifest last modified date should be equal to the file date",
- PluginManager.getModificationDate(url),
+ assertThat("Manifest last modified date should be equal to the file date",
+ PluginManager.getModificationDate(url),
equalTo(jar.lastModified()));
}
-
+
private static void assertAttribute(Manifest manifest, String attributeName, String value) {
Attributes attributes = manifest.getMainAttributes();
assertThat("Main attributes must not be empty", attributes, notNullValue());
- assertThat("Attribute '" + attributeName + "' does not match the sample",
- attributes.getValue(attributeName),
+ assertThat("Attribute '" + attributeName + "' does not match the sample",
+ attributes.getValue(attributeName),
equalTo(value));
-
+
}
-
+
private static final String SAMPLE_MANIFEST_FILE = "Manifest-Version: 1.0\n" +
"Archiver-Version: Plexus Archiver\n" +
"Created-By: Apache Maven\n" +
@@ -146,12 +146,12 @@ private static void assertAttribute(Manifest manifest, String attributeName, Str
"Plugin-Dependencies: icon-shim:2.0.3,cloudbees-folder:5.2.2;resolution\n" +
" :=optional\n" +
"Plugin-Developers: ";
-
+
private File createHpiWithManifest() throws IOException {
String manifestPath = "META-INF/MANIFEST.MF";
new File("META-INF").mkdir();
FileUtils.write(new File(tmp.toFile(), manifestPath), SAMPLE_MANIFEST_FILE, StandardCharsets.UTF_8);
-
+
final File f = new File(tmp.toFile(), "my.hpi");
try(ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(f.toPath()))) {
ZipEntry e = new ZipEntry(manifestPath);
@@ -162,10 +162,10 @@ private File createHpiWithManifest() throws IOException {
}
return f;
}
-
-
+
+
private URL toManifestUrl(File jarFile) throws MalformedURLException {
final String manifestPath = "META-INF/MANIFEST.MF";
return new URL("jar:" + jarFile.toURI().toURL() + "!/" + manifestPath);
- }
+ }
}
diff --git a/core/src/test/java/hudson/PluginWrapperTest.java b/core/src/test/java/hudson/PluginWrapperTest.java
index 0a0e51a588ff..9b7842e4a6b8 100644
--- a/core/src/test/java/hudson/PluginWrapperTest.java
+++ b/core/src/test/java/hudson/PluginWrapperTest.java
@@ -36,7 +36,7 @@
public class PluginWrapperTest {
private static Locale loc;
-
+
@BeforeAll
public static void before() {
Jenkins.VERSION = "2.0"; // Some value needed - tests will overwrite if necessary
@@ -50,7 +50,7 @@ public static void after() {
Locale.setDefault(loc);
}
}
-
+
@Test
public void dependencyTest() {
String version = "plugin:0.0.2";
@@ -131,7 +131,7 @@ private void assertInjectingJarsWorks(ClassLoader cl) throws Exception {
assertThat("expect one more element from the updated classloader",
e2size - e1size, is(1));
}
-
+
private void assertContains(Throwable ex, String... patterns) {
String msg = ex.getMessage();
for (String pattern : patterns) {
diff --git a/core/src/test/java/hudson/UtilTest.java b/core/src/test/java/hudson/UtilTest.java
index 253b7b7a326d..2eed7e9c866b 100644
--- a/core/src/test/java/hudson/UtilTest.java
+++ b/core/src/test/java/hudson/UtilTest.java
@@ -100,7 +100,7 @@ public void testReplaceMacro() {
assertEquals("a.B", Util.replaceMacro("$A.B", m));
assertEquals("a-b", Util.replaceMacro("${A.B}", m));
- // test that more complex scenarios work
+ // test that more complex scenarios work
assertEquals("/a/B/aa", Util.replaceMacro("/$A/$B/$AA",m));
assertEquals("a-aa", Util.replaceMacro("$A-$AA",m));
assertEquals("/a/foo/can/B/you-believe_aa~it?", Util.replaceMacro("/$A/foo/can/$B/you-believe_$AA~it?",m));
@@ -354,50 +354,50 @@ public void testHtmlEscape() {
@Issue("JENKINS-10346")
@Test
public void testDigestThreadSafety() throws InterruptedException {
- String a = "abcdefgh";
- String b = "123456789";
+ String a = "abcdefgh";
+ String b = "123456789";
- String digestA = Util.getDigestOf(a);
- String digestB = Util.getDigestOf(b);
+ String digestA = Util.getDigestOf(a);
+ String digestB = Util.getDigestOf(b);
- DigesterThread t1 = new DigesterThread(a, digestA);
- DigesterThread t2 = new DigesterThread(b, digestB);
+ DigesterThread t1 = new DigesterThread(a, digestA);
+ DigesterThread t2 = new DigesterThread(b, digestB);
- t1.start();
- t2.start();
+ t1.start();
+ t2.start();
- t1.join();
- t2.join();
+ t1.join();
+ t2.join();
- if (t1.error != null) {
- fail(t1.error);
- }
- if (t2.error != null) {
- fail(t2.error);
- }
+ if (t1.error != null) {
+ fail(t1.error);
+ }
+ if (t2.error != null) {
+ fail(t2.error);
+ }
}
private static class DigesterThread extends Thread {
- private String string;
- private String expectedDigest;
-
- private String error;
-
- DigesterThread(String string, String expectedDigest) {
- this.string = string;
- this.expectedDigest = expectedDigest;
- }
-
- @Override
- public void run() {
- for (int i=0; i < 1000; i++) {
- String digest = Util.getDigestOf(this.string);
- if (!this.expectedDigest.equals(digest)) {
- this.error = "Expected " + this.expectedDigest + ", but got " + digest;
- break;
- }
- }
- }
+ private String string;
+ private String expectedDigest;
+
+ private String error;
+
+ DigesterThread(String string, String expectedDigest) {
+ this.string = string;
+ this.expectedDigest = expectedDigest;
+ }
+
+ @Override
+ public void run() {
+ for (int i=0; i < 1000; i++) {
+ String digest = Util.getDigestOf(this.string);
+ if (!this.expectedDigest.equals(digest)) {
+ this.error = "Expected " + this.expectedDigest + ", but got " + digest;
+ break;
+ }
+ }
+ }
}
@Test
diff --git a/core/src/test/java/hudson/XmlFileTest.java b/core/src/test/java/hudson/XmlFileTest.java
index 49a1dbb9f2ca..dc4936b73f2e 100644
--- a/core/src/test/java/hudson/XmlFileTest.java
+++ b/core/src/test/java/hudson/XmlFileTest.java
@@ -58,7 +58,7 @@ public void canReadXml1_1Test() throws IOException {
assertThat(n.getMode().toString(), is("NORMAL"));
}
}
-
+
@Test
public void canReadXmlWithControlCharsTest() throws IOException {
URL configUrl = getClass().getResource("/hudson/config_1_1_with_special_chars.xml");
diff --git a/core/src/test/java/hudson/console/UrlAnnotatorTest.java b/core/src/test/java/hudson/console/UrlAnnotatorTest.java
index 2db878c4326f..c5a32f7c4d8f 100644
--- a/core/src/test/java/hudson/console/UrlAnnotatorTest.java
+++ b/core/src/test/java/hudson/console/UrlAnnotatorTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Alan Harder
- *
+ *
* 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
diff --git a/core/src/test/java/hudson/model/AbstractItemTest.java b/core/src/test/java/hudson/model/AbstractItemTest.java
index 2be49a527e55..e03d89207af6 100644
--- a/core/src/test/java/hudson/model/AbstractItemTest.java
+++ b/core/src/test/java/hudson/model/AbstractItemTest.java
@@ -26,16 +26,16 @@ protected StubAbstractItem() {
public Collection extends Job> getAllJobs() {
return null;
}
-
+
/**
* Override save so that nothing happens when setDisplayName() is called
*/
@Override
public void save() {
-
+
}
}
-
+
@Test
public void testSetDisplayName() throws Exception {
final String displayName = "testDisplayName";
@@ -43,7 +43,7 @@ public void testSetDisplayName() throws Exception {
i.setDisplayName(displayName);
assertEquals(displayName, i.getDisplayName());
}
-
+
@Test
public void testGetDefaultDisplayName() {
final String name = "the item name";
@@ -51,18 +51,18 @@ public void testGetDefaultDisplayName() {
i.doSetName(name);
// assert that if the displayname is not set, the name is actually returned
assertEquals(name, i.getDisplayName());
-
+
}
-
+
@Test
public void testSearchNameIsName() {
final String name = "the item name jlrtlekjtekrjkjr";
StubAbstractItem i = new StubAbstractItem();
i.doSetName(name);
-
+
assertEquals(i.getName(), i.getSearchName());
}
-
+
@Test
public void testGetDisplayNameOrNull() throws Exception {
final String projectName = "projectName";
@@ -71,7 +71,7 @@ public void testGetDisplayNameOrNull() throws Exception {
i.doSetName(projectName);
assertEquals(projectName, i.getName());
assertNull(i.getDisplayNameOrNull());
-
+
i.setDisplayName(displayName);
assertEquals(displayName, i.getDisplayNameOrNull());
}
diff --git a/core/src/test/java/hudson/model/BuildStatusSummaryTest.java b/core/src/test/java/hudson/model/BuildStatusSummaryTest.java
index 8b66e6835249..2685beae2720 100644
--- a/core/src/test/java/hudson/model/BuildStatusSummaryTest.java
+++ b/core/src/test/java/hudson/model/BuildStatusSummaryTest.java
@@ -12,7 +12,7 @@
/**
* Tests {@link Run#getBuildStatusSummary()}.
- *
+ *
* @author kutzi
*/
@SuppressWarnings("rawtypes")
@@ -25,132 +25,132 @@ public class BuildStatusSummaryTest {
public void before() {
mockBuilds(Run.class);
}
-
+
private void mockBuilds(Class extends Run> buildClass) {
this.build = mock(buildClass);
this.prevBuild = mock(buildClass);
-
+
when(this.build.getPreviousBuild()).thenReturn(prevBuild);
-
+
when(this.build.getBuildStatusSummary()).thenCallRealMethod();
}
-
+
@Test
public void testStatusUnknownIfRunIsStillBuilding() {
when(this.build.getResult()).thenReturn(null);
when(this.build.isBuilding()).thenReturn(true);
-
+
Summary summary = this.build.getBuildStatusSummary();
assertEquals(Messages.Run_Summary_Unknown(), summary.message);
}
-
+
@Test
public void testSuccess() {
when(this.build.getResult()).thenReturn(Result.SUCCESS);
when(this.prevBuild.getResult()).thenReturn(Result.SUCCESS);
-
+
Summary summary = this.build.getBuildStatusSummary();
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Stable(), summary.message);
-
+
// same if there is no previous build
when(this.build.getPreviousBuild()).thenReturn(null);
summary = this.build.getBuildStatusSummary();
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Stable(), summary.message);
-
+
// from NOT_BUILD should also mean normal success and not 'back to normal'
when(this.prevBuild.getResult()).thenReturn(Result.NOT_BUILT);
-
+
summary = this.build.getBuildStatusSummary();
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Stable(), summary.message);
-
-
+
+
// same if previous one was aborted
when(this.prevBuild.getResult()).thenReturn(Result.ABORTED);
-
+
summary = this.build.getBuildStatusSummary();
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Stable(), summary.message);
}
-
+
@Test
public void testFixed() {
when(this.build.getResult()).thenReturn(Result.SUCCESS);
when(this.prevBuild.getResult()).thenReturn(Result.FAILURE);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_BackToNormal(), summary.message);
-
+
// same from unstable:
when(this.prevBuild.getResult()).thenReturn(Result.UNSTABLE);
-
+
summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_BackToNormal(), summary.message);
}
-
+
@Test
public void testFailure() {
when(this.build.getResult()).thenReturn(Result.FAILURE);
when(this.prevBuild.getResult()).thenReturn(Result.FAILURE);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_BrokenForALongTime(), summary.message);
}
-
+
@Test
public void testBecameFailure() {
when(this.build.getResult()).thenReturn(Result.FAILURE);
when(this.prevBuild.getResult()).thenReturn(Result.SUCCESS);
when(this.build.getPreviousNotFailedBuild()).thenReturn(this.prevBuild);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertTrue(summary.isWorse);
assertEquals(Messages.Run_Summary_BrokenSinceThisBuild(), summary.message);
}
-
+
@Test
public void testFailureSince() {
when(this.build.getResult()).thenReturn(Result.FAILURE);
when(this.prevBuild.getResult()).thenReturn(Result.FAILURE);
when(this.prevBuild.getDisplayName()).thenReturn("prevBuild");
-
+
Run prevPrevBuild = mock(Run.class);
when(prevPrevBuild.getNextBuild()).thenReturn(prevBuild);
- when(this.build.getPreviousNotFailedBuild()).thenReturn(prevPrevBuild);
-
+ when(this.build.getPreviousNotFailedBuild()).thenReturn(prevPrevBuild);
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_BrokenSince(this.prevBuild.getDisplayName()), summary.message);
}
-
+
@Test
public void testBecameUnstable() {
when(this.build.getResult()).thenReturn(Result.UNSTABLE);
when(this.prevBuild.getResult()).thenReturn(Result.SUCCESS);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertTrue(summary.isWorse);
//assertEquals(Messages.Run_Summary_Stable(), summary.message);
}
-
+
@Test
public void testUnstableAfterFailure() {
when(this.build.getResult()).thenReturn(Result.UNSTABLE);
when(this.prevBuild.getResult()).thenReturn(Result.FAILURE);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Unstable(), summary.message);
}
@@ -159,40 +159,40 @@ public void testUnstableAfterFailure() {
public void testNonTestRelatedUnstable() {
when(this.build.getResult()).thenReturn(Result.UNSTABLE);
when(this.prevBuild.getResult()).thenReturn(Result.UNSTABLE);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Unstable(), summary.message);
}
-
+
@Test
public void testNonTestRelatedBecameUnstable() {
when(this.build.getResult()).thenReturn(Result.UNSTABLE);
when(this.prevBuild.getResult()).thenReturn(Result.SUCCESS);
-
+
Summary summary = this.build.getBuildStatusSummary();
-
+
assertTrue(summary.isWorse);
//assertEquals(Messages.Run_Summary_Unstable(), summary.message);
}
-
+
@Test
public void testAborted() {
when(this.build.getResult()).thenReturn(Result.ABORTED);
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_Aborted(), summary.message);
}
-
+
@Test
public void testNotBuilt() {
when(this.build.getResult()).thenReturn(Result.NOT_BUILT);
Summary summary = this.build.getBuildStatusSummary();
-
+
assertFalse(summary.isWorse);
assertEquals(Messages.Run_Summary_NotBuilt(), summary.message);
}
-
+
}
diff --git a/core/src/test/java/hudson/model/DisplayNameListenerTest.java b/core/src/test/java/hudson/model/DisplayNameListenerTest.java
index 0bf74dbdc828..fbf3cbc196ba 100644
--- a/core/src/test/java/hudson/model/DisplayNameListenerTest.java
+++ b/core/src/test/java/hudson/model/DisplayNameListenerTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2011, Yahoo!, Inc.
- *
+ *
* 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
@@ -38,10 +38,10 @@ public void testOnCopied() throws Exception {
StubJob dest = new StubJob();
dest.doSetName("dest");
dest.setDisplayName("this should be cleared");
-
+
// make sure the displayname and the name are different at this point
assertNotEquals(dest.getName(), dest.getDisplayName());
-
+
listener.onCopied(src, dest);
// make sure the displayname is equals to the name as it should be null
assertEquals(dest.getName(), dest.getDisplayName());
@@ -52,12 +52,12 @@ public void testOnRenamedOldNameEqualsDisplayName() throws Exception {
DisplayNameListener listener = new DisplayNameListener();
final String oldName = "old job name";
final String newName = "new job name";
- StubJob src = new StubJob();
+ StubJob src = new StubJob();
src.doSetName(newName);
src.setDisplayName(oldName);
-
+
listener.onRenamed(src, oldName, newName);
-
+
assertEquals(newName, src.getDisplayName());
}
@@ -67,12 +67,12 @@ public void testOnRenamedOldNameNotEqualDisplayName() throws Exception {
final String oldName = "old job name";
final String newName = "new job name";
final String displayName = "the display name";
- StubJob src = new StubJob();
+ StubJob src = new StubJob();
src.doSetName(newName);
src.setDisplayName(displayName);
-
+
listener.onRenamed(src, oldName, oldName);
-
+
// make sure displayname is still intact
assertEquals(displayName, src.getDisplayName());
}
diff --git a/core/src/test/java/hudson/model/FileParameterValueTest.java b/core/src/test/java/hudson/model/FileParameterValueTest.java
index 0b079da122be..11f3d0f00072 100644
--- a/core/src/test/java/hudson/model/FileParameterValueTest.java
+++ b/core/src/test/java/hudson/model/FileParameterValueTest.java
@@ -36,29 +36,29 @@
* @author Oleg Nenashev
*/
public class FileParameterValueTest {
-
+
@Issue("JENKINS-19017")
@Test public void compareParamsWithSameName() {
final String paramName = "MY_FILE_PARAM"; // Same paramName (location) reproduces the bug
final FileParameterValue param1 = new FileParameterValue(paramName, new File("ws_param1.txt"), "param1.txt");
final FileParameterValue param2 = new FileParameterValue(paramName, new File("ws_param2.txt"), "param2.txt");
-
+
assertNotEquals("Files with same locations should be considered as different", param1, param2);
assertNotEquals("Files with same locations should be considered as different", param2, param1);
}
-
+
@Test public void compareNullParams() {
- final String paramName = "MY_FILE_PARAM";
+ final String paramName = "MY_FILE_PARAM";
FileParameterValue nonNullParam = new FileParameterValue(paramName, new File("ws_param1.txt"), "param1.txt");
FileParameterValue nullParam1 = new FileParameterValue(null, new File("null_param1.txt"), "null_param1.txt");
FileParameterValue nullParam2 = new FileParameterValue(null, new File("null_param2.txt"), "null_param2.txt");
-
+
// Combine nulls
assertEquals(nullParam1, nullParam1);
assertEquals(nullParam1, nullParam2);
assertEquals(nullParam2, nullParam1);
assertEquals(nullParam2, nullParam2);
-
+
// Compare with non-null
assertNotEquals(nullParam1, nonNullParam);
assertNotEquals(nonNullParam, nullParam1);
diff --git a/core/src/test/java/hudson/model/FingerprintTest.java b/core/src/test/java/hudson/model/FingerprintTest.java
index d7fd806e4721..edad87581fe3 100644
--- a/core/src/test/java/hudson/model/FingerprintTest.java
+++ b/core/src/test/java/hudson/model/FingerprintTest.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -45,7 +45,7 @@
public class FingerprintTest {
@Rule public TemporaryFolder tmp = new TemporaryFolder();
-
+
@Test public void rangeSet() {
RangeSet rs = new RangeSet();
assertFalse(rs.includes(0));
diff --git a/core/src/test/java/hudson/model/ParametersActionTest.java b/core/src/test/java/hudson/model/ParametersActionTest.java
index d7dab81e8c4d..bc2c2bd64fcc 100644
--- a/core/src/test/java/hudson/model/ParametersActionTest.java
+++ b/core/src/test/java/hudson/model/ParametersActionTest.java
@@ -84,35 +84,35 @@ public void createUpdatedShouldReturnNewInstanceWithNullOverride() {
assertNotSame(baseParamsAB, params);
}
-
+
@Test
@Issue("JENKINS-15094")
public void checkNullParameterValues() {
SubTask subtask = mock(SubTask.class);
Build build = mock(Build.class);
-
+
// Prepare parameters Action
StringParameterValue A = new StringParameterValue("A", "foo");
StringParameterValue B = new StringParameterValue("B", "bar");
ParametersAction parametersAction = new ParametersAction(A, null, B);
ParametersAction parametersAction2 = new ParametersAction(A,null);
-
+
// Non existent parameter
- assertNull(parametersAction.getParameter("C"));
+ assertNull(parametersAction.getParameter("C"));
assertNull(parametersAction.getAssignedLabel(subtask));
-
+
// Interaction with build
EnvVars vars = new EnvVars();
parametersAction.buildEnvironment(build, vars);
- assertEquals(2, vars.size());
+ assertEquals(2, vars.size());
parametersAction.createVariableResolver(build);
-
+
List wrappers = new ArrayList<>();
parametersAction.createBuildWrappers(build, wrappers);
assertEquals(0, wrappers.size());
-
+
// Merges and overrides
assertEquals(3, parametersAction.createUpdated(parametersAction2.getParameters()).getParameters().size());
- assertEquals(3, parametersAction.merge(parametersAction2).getParameters().size());
+ assertEquals(3, parametersAction.merge(parametersAction2).getParameters().size());
}
}
diff --git a/core/src/test/java/hudson/model/RunParameterValueTest.java b/core/src/test/java/hudson/model/RunParameterValueTest.java
index 18c5b088ab1f..8b809d6619c8 100644
--- a/core/src/test/java/hudson/model/RunParameterValueTest.java
+++ b/core/src/test/java/hudson/model/RunParameterValueTest.java
@@ -31,7 +31,7 @@
import org.junit.Test;
public class RunParameterValueTest {
-
+
@SuppressWarnings("ResultOfObjectAllocationIgnored")
@Test public void robustness() {
RunParameterValue rpv = new RunParameterValue("whatever", "folder/job#57");
diff --git a/core/src/test/java/hudson/model/UserTest.java b/core/src/test/java/hudson/model/UserTest.java
index 96e874466ea9..6995f3ea69da 100644
--- a/core/src/test/java/hudson/model/UserTest.java
+++ b/core/src/test/java/hudson/model/UserTest.java
@@ -35,7 +35,7 @@
* @author Oleg Nenashev
*/
public class UserTest {
-
+
@Test
@Issue("JENKINS-33600")
public void blankIdsOrFullNamesShouldNotBeAllowed() {
@@ -43,7 +43,7 @@ public void blankIdsOrFullNamesShouldNotBeAllowed() {
assertThat("Empty user IDs should not be allowed", User.isIdOrFullnameAllowed(""), is(false));
assertThat("Blank user IDs should not be allowed", User.isIdOrFullnameAllowed(" "), is(false));
}
-
+
@Test
@Issue("JENKINS-35967")
public void shouldNotAllowIllegalRestrictedNamesInWrongCase() {
@@ -53,7 +53,7 @@ public void shouldNotAllowIllegalRestrictedNamesInWrongCase() {
assertIdOrFullNameNotAllowed("syStem");
assertIdOrFullNameNotAllowed("sYstEm");
}
-
+
@Test
@Issue("JENKINS-35967")
public void shouldNotAllowIllegalRestrictedNamesEvenIfTrimmed() {
@@ -62,13 +62,13 @@ public void shouldNotAllowIllegalRestrictedNamesEvenIfTrimmed() {
assertIdOrFullNameNotAllowed(" " + username);
assertIdOrFullNameNotAllowed(username + " ");
assertIdOrFullNameNotAllowed(" " + username + " ");
- assertIdOrFullNameNotAllowed("\t" + username + "\t");
+ assertIdOrFullNameNotAllowed("\t" + username + "\t");
}
}
-
+
private void assertIdOrFullNameNotAllowed(String id) {
- assertThat("User ID or full name '" + id + "' should not be allowed",
+ assertThat("User ID or full name '" + id + "' should not be allowed",
User.isIdOrFullnameAllowed(id), is(false));
}
-
+
}
diff --git a/core/src/test/java/hudson/model/ViewTest.java b/core/src/test/java/hudson/model/ViewTest.java
index dab90dbae3d9..e5374f133286 100644
--- a/core/src/test/java/hudson/model/ViewTest.java
+++ b/core/src/test/java/hudson/model/ViewTest.java
@@ -30,7 +30,7 @@ public void testAddDisplayNamesToSearchIndex() {
final String displayName1 = "displayName1";
final String url2 = "url2";
final String displayName2 = "displayName2";
-
+
SearchIndexBuilder sib = new SearchIndexBuilder();
// mock the items to be indexed
TopLevelItem item1 = Mockito.mock(TopLevelItem.class);
@@ -42,7 +42,7 @@ public void testAddDisplayNamesToSearchIndex() {
Collection items = new ArrayList<>();
items.add(item1);
items.add(item2);
-
+
// mock the view class except for the addDisplayNamesToSearchIndex() call as that
// is what we are testing
View view = Mockito.mock(View.class);
@@ -51,9 +51,9 @@ public void testAddDisplayNamesToSearchIndex() {
// now make the actual call to index items
view.addDisplayNamesToSearchIndex(sib, items);
- // make and index with sib
+ // make and index with sib
SearchIndex index = sib.make();
-
+
// now make sure we can fetch item1 from the index
List result = new ArrayList<>();
index.find(displayName1, result);
@@ -87,9 +87,9 @@ public void getAllItems() {
final TopLevelItem rootJob = createJob("rootJob");
final TopLevelItem sharedJob = createJob("sharedJob");
-
+
rootView = rootView.withJobs(rootJob, sharedJob);
-
+
final TopLevelItem leftJob = createJob("leftJob");
final TopLevelItem rightJob = createJob("rightJob");
@@ -132,12 +132,12 @@ protected CompositeView(final String name, View... views) {
super(name);
this.views = views;
}
-
+
private CompositeView withJobs(TopLevelItem... jobs) {
this.jobs = jobs;
return this;
}
-
+
@Override
public Collection getItems() {
return Arrays.asList(this.jobs);
@@ -147,7 +147,7 @@ public Collection getItems() {
public Collection getViews() {
return Arrays.asList(this.views);
}
-
+
@Override
public boolean canDelete(View view) {
return false;
diff --git a/core/src/test/java/hudson/model/listeners/SCMListenerTest.java b/core/src/test/java/hudson/model/listeners/SCMListenerTest.java
index ef201fc0a391..a85a4b7803c7 100644
--- a/core/src/test/java/hudson/model/listeners/SCMListenerTest.java
+++ b/core/src/test/java/hudson/model/listeners/SCMListenerTest.java
@@ -69,7 +69,7 @@ public class SCMListenerTest {
l.onChangeLogParsed(r, scm, tl, cls);
assertEquals("cannot handle this", 0, l.cnt);
}
-
+
private static class L extends SCMListener {
int cnt;
}
diff --git a/core/src/test/java/hudson/scheduler/CronTabDayOfWeekLocaleTest.java b/core/src/test/java/hudson/scheduler/CronTabDayOfWeekLocaleTest.java
index 1588f133685f..f9a287f2bc4c 100644
--- a/core/src/test/java/hudson/scheduler/CronTabDayOfWeekLocaleTest.java
+++ b/core/src/test/java/hudson/scheduler/CronTabDayOfWeekLocaleTest.java
@@ -36,13 +36,13 @@ public static Collection
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
@@ -156,16 +138,36 @@ THE SOFTWARE.
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
install
- ${basedir}/src/main/resourcesfalse
+ ${basedir}/src/main/resources
- ${basedir}/src/filter/resourcestrue
+ ${basedir}/src/filter/resources
@@ -236,7 +238,8 @@ THE SOFTWARE.
3600true
- false
+
+ falsealphabetical
@@ -392,13 +395,6 @@ THE SOFTWARE.
org.apache.maven.pluginsmaven-checkstyle-plugin
-
-
- com.puppycrawl.tools
- checkstyle
- 9.2.1
-
- true
@@ -493,13 +489,20 @@ THE SOFTWARE.
+
+
+ com.puppycrawl.tools
+ checkstyle
+ 9.2.1
+
+ validate
- validatecheck
+ validate
@@ -511,8 +514,20 @@ THE SOFTWARE.
+
+ true
+
+
+
+
+ ${project.build.sourceEncoding}
+ \n
+ false
+ true
+
+
@@ -561,13 +576,6 @@ THE SOFTWARE.
org.codehaus.mojoanimal-sniffer-maven-plugin
-
-
-
- check
-
-
- org.codehaus.mojo.signature
@@ -575,6 +583,13 @@ THE SOFTWARE.
1.0
+
+
+
+ check
+
+
+
@@ -685,10 +700,10 @@ THE SOFTWARE.
sign-artifacts
- verifysign
+ verify
@@ -703,14 +718,14 @@ THE SOFTWARE.
m2e
-
- target
- m2e.version
+
+ target
+ ${m2BuildDirectory}
@@ -745,6 +760,9 @@ THE SOFTWARE.
jdk11
+
+ 11
+ none
@@ -756,9 +774,6 @@ THE SOFTWARE.
once we drop support for JDK 8 that only recognize source and target. -->
${java.level}
-
- 11
-
diff --git a/src/spotbugs/spotbugs-excludes.xml b/src/spotbugs/spotbugs-excludes.xml
index b08e519512f3..17ee189827ef 100644
--- a/src/spotbugs/spotbugs-excludes.xml
+++ b/src/spotbugs/spotbugs-excludes.xml
@@ -83,12 +83,235 @@
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -133,10 +356,6 @@
-
-
-
-
@@ -150,10 +369,6 @@
-
-
-
-
@@ -220,10 +435,6 @@
-
-
-
-
diff --git a/test/pom.xml b/test/pom.xml
index 6729dcb63072..5d949a610cd6 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -37,9 +37,11 @@ THE SOFTWARE.
Functional tests for Jenkins core
- 2
+
+ 2false
-
+
+
@@ -196,11 +198,11 @@ THE SOFTWARE.
old-remoting-for-test
- generate-test-resourcescopy
+ generate-test-resources
@@ -314,10 +316,10 @@ THE SOFTWARE.
-->
post-unit-test
- testreport
+ test${project.build.directory}/coverage-reports/jacoco-ut.exec
diff --git a/test/src/test/java/hudson/AboutJenkinsTest.java b/test/src/test/java/hudson/AboutJenkinsTest.java
index 0229b5b9d8fc..4eb9b5db4105 100644
--- a/test/src/test/java/hudson/AboutJenkinsTest.java
+++ b/test/src/test/java/hudson/AboutJenkinsTest.java
@@ -40,10 +40,10 @@
@Category(SmokeTest.class)
public class AboutJenkinsTest {
-
+
@Rule
public JenkinsRule j = new JenkinsRule();
-
+
@Test
@Issue("SECURITY-771")
public void onlyAdminOrManageOrSystemReadCanReadAbout() throws Exception {
@@ -52,7 +52,7 @@ public void onlyAdminOrManageOrSystemReadCanReadAbout() throws Exception {
final String MANAGER = "manager";
final String READONLY = "readonly";
final String MANAGER_READONLY = "manager-readonly";
-
+
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy()
// full access
@@ -74,16 +74,16 @@ public void onlyAdminOrManageOrSystemReadCanReadAbout() throws Exception {
.grant(Jenkins.MANAGE).everywhere().to(MANAGER_READONLY)
.grant(Jenkins.SYSTEM_READ).everywhere().to(MANAGER_READONLY)
);
-
+
JenkinsRule.WebClient wc = j.createWebClient()
.withThrowExceptionOnFailingStatusCode(false);
-
+
{ // user cannot see it
wc.login(USER);
HtmlPage page = wc.goTo("about/");
assertEquals(HttpURLConnection.HTTP_FORBIDDEN, page.getWebResponse().getStatusCode());
}
-
+
{ // admin can access it
wc.login(ADMIN);
HtmlPage page = wc.goTo("about/");
@@ -109,5 +109,5 @@ public void onlyAdminOrManageOrSystemReadCanReadAbout() throws Exception {
assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
}
}
-
+
}
diff --git a/test/src/test/java/hudson/ClassicPluginStrategyTest.java b/test/src/test/java/hudson/ClassicPluginStrategyTest.java
index c046d12e66ee..8038e697cddc 100644
--- a/test/src/test/java/hudson/ClassicPluginStrategyTest.java
+++ b/test/src/test/java/hudson/ClassicPluginStrategyTest.java
@@ -55,7 +55,7 @@ public class ClassicPluginStrategyTest {
@Override
protected Hudson newHudson() throws Exception {
File home = homeLoader.allocate();
-
+
for (JenkinsRecipe.Runner r : recipes) {
r.decorateHome(this,home);
}
diff --git a/test/src/test/java/hudson/CustomPluginManagerTest.java b/test/src/test/java/hudson/CustomPluginManagerTest.java
index 0b702dcc73a5..bd7a20aada54 100644
--- a/test/src/test/java/hudson/CustomPluginManagerTest.java
+++ b/test/src/test/java/hudson/CustomPluginManagerTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2016 CloudBees, Inc.
- *
+ *
* 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
diff --git a/test/src/test/java/hudson/ExtensionFinderTest.java b/test/src/test/java/hudson/ExtensionFinderTest.java
index 4eb61bae16de..53b4e0829bca 100644
--- a/test/src/test/java/hudson/ExtensionFinderTest.java
+++ b/test/src/test/java/hudson/ExtensionFinderTest.java
@@ -133,7 +133,7 @@ public void errorRecovery() {
public static class BrokenExtension extends PageDecorator {
public BrokenExtension() {
super(InjectingExtension.class);
-
+
throw new Error();
}
}
diff --git a/test/src/test/java/hudson/FilePathTest.java b/test/src/test/java/hudson/FilePathTest.java
index f5f4eb8adee8..48786eee7610 100644
--- a/test/src/test/java/hudson/FilePathTest.java
+++ b/test/src/test/java/hudson/FilePathTest.java
@@ -97,11 +97,11 @@ public void zipAbsolutePathHandledCorrectly_win() throws Exception {
FilePath zipFile = r.jenkins.getRootPath().child("zip-slip-win.zip");
FilePath targetLocation = r.jenkins.getRootPath().child("unzip-target");
-
+
FilePath good = targetLocation.child("good.txt");
assertThat(good.exists(), is(false));
-
+
IOException e = assertThrows(IOException.class, () -> zipFile.unzip(targetLocation));
assertThat(e.getMessage(), containsString("contains illegal file name that breaks out of the target directory"));
@@ -155,7 +155,7 @@ public void zipRelativePathHandledCorrectly_oneUp() throws Exception {
assertThat(simple3.exists(), is(false));
}
-
+
@Test
@Issue("XXX")
@LocalData("zip_with_relative")
diff --git a/test/src/test/java/hudson/LauncherTest.java b/test/src/test/java/hudson/LauncherTest.java
index 3833b07d2168..4cfbfd11e21c 100644
--- a/test/src/test/java/hudson/LauncherTest.java
+++ b/test/src/test/java/hudson/LauncherTest.java
@@ -91,14 +91,14 @@ public void correctlyExpandEnvVars() throws Exception {
rule.assertLogContains("aaa aaaccc ccc", build);
}
-
+
@Issue("JENKINS-19926")
@Test
public void overwriteSystemEnvVars() throws Exception {
Map env = new HashMap<>();
env.put("jenkins_19926", "original value");
Slave slave = rule.createSlave(new EnvVars(env));
-
+
FreeStyleProject project = rule.createFreeStyleProject();
project.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("jenkins_19926", "${jenkins_19926} and new value")));
final CommandInterpreter script = Functions.isWindows()
diff --git a/test/src/test/java/hudson/PluginManagerTest.java b/test/src/test/java/hudson/PluginManagerTest.java
index adc30e6aa6cc..06e4722b0bbe 100644
--- a/test/src/test/java/hudson/PluginManagerTest.java
+++ b/test/src/test/java/hudson/PluginManagerTest.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -148,7 +148,7 @@ public void doDynamic(StaplerRequest staplerRequest, StaplerResponse staplerResp
staplerResponse.serveFile(staplerRequest, PluginManagerTest.class.getClassLoader().getResource("plugins/htmlpublisher.jpi"));
}
}
-
+
/**
* Tests the effect of {@link WithPlugin}.
*/
@@ -156,7 +156,7 @@ public void doDynamic(StaplerRequest staplerRequest, StaplerResponse staplerResp
@Test public void withRecipeJpi() {
assertNotNull(r.jenkins.getPlugin("htmlpublisher"));
}
-
+
/**
* Tests the effect of {@link WithPlugin}.
*/
@@ -265,10 +265,10 @@ public void startPlugin(PluginWrapper plugin) throws Exception {
// return "dependee";
// }
// }
- //
+ //
// public abstract class DependeeExtensionPoint implements ExtensionPoint {
// }
- //
+ //
// org.jenkinsci.plugins.dependencytest.depender:
// public class Depender {
// public static String getValue() {
@@ -278,12 +278,12 @@ public void startPlugin(PluginWrapper plugin) throws Exception {
// return "depender";
// }
// }
- //
+ //
// @Extension(optional=true)
// public class DependerExtension extends DependeeExtensionPoint {
// }
-
-
+
+
/**
* call org.jenkinsci.plugins.dependencytest.depender.Depender.getValue().
*/
@@ -292,7 +292,7 @@ private String callDependerValue() throws Exception {
Method m = c.getMethod("getValue");
return (String)m.invoke(null);
}
-
+
/**
* Load "dependee" and then load "depender".
* Asserts that "depender" can access to "dependee".
@@ -302,25 +302,25 @@ private String callDependerValue() throws Exception {
{
dynamicLoad("dependee.hpi");
}
-
+
// before load depender, of course failed to call Depender.getValue()
assertThrows(ClassNotFoundException.class, this::callDependerValue);
-
+
// No extensions exist.
assertTrue(r.jenkins.getExtensionList("org.jenkinsci.plugins.dependencytest.dependee.DependeeExtensionPoint").isEmpty());
-
+
// Load depender.
{
dynamicLoad("depender.hpi");
}
-
+
// depender successfully accesses to dependee.
assertEquals("dependee", callDependerValue());
-
+
// Extension in depender is loaded.
assertFalse(r.jenkins.getExtensionList("org.jenkinsci.plugins.dependencytest.dependee.DependeeExtensionPoint").isEmpty());
}
-
+
/**
* Load "depender" and then load "dependee".
* Asserts that "depender" can access to "dependee".
@@ -331,10 +331,10 @@ private String callDependerValue() throws Exception {
{
dynamicLoad("depender.hpi");
}
-
+
// before load dependee, depender does not access to dependee.
assertEquals("depender", callDependerValue());
-
+
// before load dependee, of course failed to list extensions for dependee.
assertThrows(ClassNotFoundException.class, () -> r.jenkins.getExtensionList("org.jenkinsci.plugins.dependencytest.dependee.DependeeExtensionPoint"));
// Extension extending a dependee class can't be loaded either
@@ -344,7 +344,7 @@ private String callDependerValue() throws Exception {
{
dynamicLoad("dependee.hpi");
}
-
+
// (MUST) Not throws an exception
// (SHOULD) depender successfully accesses to dependee.
assertEquals("dependee", callDependerValue());
@@ -525,17 +525,17 @@ private void dynamicLoadAndDisable(String plugin) throws IOException, Interrupte
// wait for all the download jobs to complete
boolean done = true;
- boolean passed = true;
+ boolean passed = true;
do {
Thread.sleep(100);
- done = true;
- for(UpdateCenterJob job : r.jenkins.getUpdateCenter().getJobs()) {
+ done = true;
+ for(UpdateCenterJob job : r.jenkins.getUpdateCenter().getJobs()) {
if(job instanceof UpdateCenter.DownloadJob) {
- UpdateCenter.DownloadJob j = (UpdateCenter.DownloadJob)job;
- assertFalse(j.status instanceof UpdateCenter.DownloadJob.Failure);
+ UpdateCenter.DownloadJob j = (UpdateCenter.DownloadJob)job;
+ assertFalse(j.status instanceof UpdateCenter.DownloadJob.Failure);
done &= !(j.status instanceof UpdateCenter.DownloadJob.Pending ||
- j.status instanceof UpdateCenter.DownloadJob.Installing);
- }
+ j.status instanceof UpdateCenter.DownloadJob.Installing);
+ }
}
} while(!done);
diff --git a/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java b/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java
index 9ca40255bb5f..ba9896d3bdba 100644
--- a/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java
+++ b/test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -60,7 +60,7 @@
import org.jvnet.hudson.test.recipes.PresetData.DataSet;
/**
- * Makes sure that the jars that web start needs are readable, even when the anonymous user doesn't have any read access.
+ * Makes sure that the jars that web start needs are readable, even when the anonymous user doesn't have any read access.
*
* @author Kohsuke Kawaguchi
*/
@@ -84,7 +84,7 @@ protected Slave createNewJnlpSlave(String name) throws Exception {
@Test
public void anonymousCanAlwaysLoadJARs() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
r.jenkins.setNodes(Collections.singletonList(createNewJnlpSlave("test")));
JenkinsRule.WebClient wc = r.createWebClient();
HtmlPage p = wc.withBasicApiToken(User.getById("alice", true)).goTo("computer/test/");
@@ -99,7 +99,7 @@ public void anonymousCanAlwaysLoadJARs() throws Exception {
for( Object jar : dom.selectNodes("//jar") ) {
URL url = new URL(baseUrl,((Element)jar).attributeValue("href"));
System.out.println(url);
-
+
// now make sure that these URLs are unprotected
Page jarResource = jnlpAgent.getPage(url);
assertTrue(jarResource.getWebResponse().getContentType().toLowerCase(Locale.ENGLISH).startsWith("application/"));
diff --git a/test/src/test/java/hudson/bugs/seasar/package-info.java b/test/src/test/java/hudson/bugs/seasar/package-info.java
index 7754314705e1..b6bea7282b59 100644
--- a/test/src/test/java/hudson/bugs/seasar/package-info.java
+++ b/test/src/test/java/hudson/bugs/seasar/package-info.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/test/src/test/java/hudson/cli/BuildCommandTest.java b/test/src/test/java/hudson/cli/BuildCommandTest.java
index c187a5205a84..6d075a9e3aa4 100644
--- a/test/src/test/java/hudson/cli/BuildCommandTest.java
+++ b/test/src/test/java/hudson/cli/BuildCommandTest.java
@@ -226,7 +226,7 @@ public void executorsAliveOnParameterWithNullDefaultValue() throws Exception {
FreeStyleProject project = j.createFreeStyleProject("foo");
project.setAssignedNode(slave);
- // Create test parameter with Null default value
+ // Create test parameter with Null default value
NullDefaultValueParameterDefinition nullDefaultDefinition = new NullDefaultValueParameterDefinition();
ParametersDefinitionProperty pdp = new ParametersDefinitionProperty(
new StringParameterDefinition("string", "defaultValue", "description"),
diff --git a/test/src/test/java/hudson/cli/CLIActionTest.java b/test/src/test/java/hudson/cli/CLIActionTest.java
index 69ed23a7e598..457ecaf554cc 100644
--- a/test/src/test/java/hudson/cli/CLIActionTest.java
+++ b/test/src/test/java/hudson/cli/CLIActionTest.java
@@ -78,7 +78,7 @@ public void serveCliActionToAnonymousUserWithAnonymousUserWithPermissions() thro
@Test
public void authentication() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
logging.record(PlainCLIProtocol.class, Level.FINE);
File jar = tmp.newFile("jenkins-cli.jar");
FileUtils.copyURLToFile(j.jenkins.getJnlpJars("jenkins-cli.jar").getURL(), jar);
diff --git a/test/src/test/java/hudson/cli/CLITest.java b/test/src/test/java/hudson/cli/CLITest.java
index 0cfecbda0d19..ae308b118efb 100644
--- a/test/src/test/java/hudson/cli/CLITest.java
+++ b/test/src/test/java/hudson/cli/CLITest.java
@@ -74,7 +74,7 @@ public class CLITest {
@ClassRule
public static BuildWatcher buildWatcher = new BuildWatcher();
-
+
@Rule
public JenkinsRule r = new JenkinsRule();
@@ -170,7 +170,7 @@ public void redirectToEndpointShouldBeFollowed() throws Exception {
JenkinsRule.WebClient wc = r.createWebClient()
.withRedirectEnabled(false)
.withThrowExceptionOnFailingStatusCode(false);
-
+
WebResponse rsp = wc.goTo("cli-proxy/").getWebResponse();
assertEquals(rsp.getContentAsString(), HttpURLConnection.HTTP_MOVED_TEMP, rsp.getStatusCode());
assertNull(rsp.getContentAsString(), rsp.getResponseHeaderValue("X-Jenkins"));
diff --git a/test/src/test/java/hudson/cli/ConsoleCommandTest.java b/test/src/test/java/hudson/cli/ConsoleCommandTest.java
index e3a232b4ad4b..a23a678a119f 100644
--- a/test/src/test/java/hudson/cli/ConsoleCommandTest.java
+++ b/test/src/test/java/hudson/cli/ConsoleCommandTest.java
@@ -75,23 +75,23 @@ public class ConsoleCommandTest {
assertThat(result, hasNoStandardOutput());
assertThat(result.stderr(), containsString("ERROR: No such job 'aProject'"));
}
-
+
@Issue("JENKINS-52181")
- @Test public void consoleShouldBeAccessibleForUserWithRead() throws Exception {
- FreeStyleProject project = j.createFreeStyleProject("aProject");
+ @Test public void consoleShouldBeAccessibleForUserWithRead() throws Exception {
+ FreeStyleProject project = j.createFreeStyleProject("aProject");
if (Functions.isWindows()) {
project.getBuildersList().add(new BatchFile("echo 1"));
} else {
project.getBuildersList().add(new Shell("echo 1"));
}
j.assertLogContains("echo 1", j.buildAndAssertSuccess(project));
-
- final CLICommandInvoker.Result result = command
- .authorizedTo(Jenkins.READ, Item.READ)
- .invokeWithArgs("aProject");
-
+
+ final CLICommandInvoker.Result result = command
+ .authorizedTo(Jenkins.READ, Item.READ)
+ .invokeWithArgs("aProject");
+
assertThat(result, succeeded());
- assertThat(result.stdout(), containsString("echo 1"));
+ assertThat(result.stdout(), containsString("echo 1"));
}
@Test public void consoleShouldFailWhenProjectDoesNotExist() {
diff --git a/test/src/test/java/hudson/cli/ListPluginsCommandTest.java b/test/src/test/java/hudson/cli/ListPluginsCommandTest.java
index 7bd7e2df7d2b..4cd2ee0a08d4 100644
--- a/test/src/test/java/hudson/cli/ListPluginsCommandTest.java
+++ b/test/src/test/java/hudson/cli/ListPluginsCommandTest.java
@@ -36,10 +36,10 @@
import org.jvnet.hudson.test.JenkinsRule;
public class ListPluginsCommandTest {
-
+
@Rule
public JenkinsRule j = new JenkinsRule();
-
+
@Test
public void listPluginsExpectedUsage() {
assertNull(j.jenkins.getPluginManager().getPlugin("token-macro"));
@@ -48,20 +48,20 @@ public void listPluginsExpectedUsage() {
assertThat(result, CLICommandInvoker.Matcher.succeeded());
assertThat(result, CLICommandInvoker.Matcher.hasNoStandardOutput());
assertThat(result.stdout(), not(containsString("token-macro")));
-
+
assertThat(new CLICommandInvoker(j, new InstallPluginCommand()).
withStdin(ListPluginsCommandTest.class.getResourceAsStream("/plugins/token-macro.hpi")).
invokeWithArgs("-name", "token-macro", "-deploy", "="),
CLICommandInvoker.Matcher.succeeded());
assertNotNull(j.jenkins.getPluginManager().getPlugin("token-macro"));
-
+
result = new CLICommandInvoker(j, new ListPluginsCommand())
.invoke()
;
assertThat(result, CLICommandInvoker.Matcher.succeeded());
assertThat(result.stdout(), containsString("token-macro"));
}
-
+
@Test
@Issue("SECURITY-771")
public void onlyAccessibleForAdmin() {
@@ -69,7 +69,7 @@ public void onlyAccessibleForAdmin() {
.authorizedTo(Jenkins.READ)
.invoke();
assertThat(result, CLICommandInvoker.Matcher.failedWith(6 /* not authorized */));
-
+
result = new CLICommandInvoker(j, new ListPluginsCommand())
.authorizedTo(Jenkins.ADMINISTER)
.invoke()
diff --git a/test/src/test/java/hudson/diagnosis/HudsonHomeDiskUsageMonitorTest.java b/test/src/test/java/hudson/diagnosis/HudsonHomeDiskUsageMonitorTest.java
index dbb1ccaaea64..8ba103252d6c 100644
--- a/test/src/test/java/hudson/diagnosis/HudsonHomeDiskUsageMonitorTest.java
+++ b/test/src/test/java/hudson/diagnosis/HudsonHomeDiskUsageMonitorTest.java
@@ -61,7 +61,7 @@ public void flow() throws Exception {
@Test
public void noAccessForNonAdmin() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
JenkinsRule.WebClient wc = j.createWebClient()
.withThrowExceptionOnFailingStatusCode(false);
diff --git a/test/src/test/java/hudson/diagnosis/ReverseProxySetupMonitorTest.java b/test/src/test/java/hudson/diagnosis/ReverseProxySetupMonitorTest.java
index ee5fbe24a621..d020f87975a4 100644
--- a/test/src/test/java/hudson/diagnosis/ReverseProxySetupMonitorTest.java
+++ b/test/src/test/java/hudson/diagnosis/ReverseProxySetupMonitorTest.java
@@ -50,9 +50,9 @@ protected JenkinsRule createJenkinsRule(Description description) {
return j;
}
};
-
+
private String desiredContextPath;
-
+
@Before
public void resetContextPath() {
this.desiredContextPath = "/jenkins";
@@ -133,7 +133,7 @@ public void evaluate() throws Throwable {
WebRequest request = new WebRequest(new URL(j.getURL(), getAdminMonitorTestUrl(j)));
request.setAdditionalHeader("Referer", j.getURL() + "manage");
- // As the rootURL is missing the context, a regular test will fail
+ // As the rootURL is missing the context, a regular test will fail
assertThrows(FailingHttpStatusCodeException.class, () -> wc.getPage(request));
// When testing with the context, it will be OK, allowing to display an additional message
@@ -225,7 +225,7 @@ public void evaluate() throws Throwable {
WebRequest request = new WebRequest(new URL(getRootUrlWithIp(j), getAdminMonitorTestUrl(j)));
// referer using IP
request.setAdditionalHeader("Referer", getRootUrlWithIp(j) + "manage");
-
+
// by default the JenkinsRule set the rootURL to localhost:/jenkins
// even with similar request and referer, if the root URL is set, this will show a wrong proxy setting
assertThrows(FailingHttpStatusCodeException.class, () -> wc.getPage(request));
@@ -267,7 +267,7 @@ public void evaluate() throws Throwable {
// referer using IP
request.setAdditionalHeader("Referer", getRootUrlWithIp(j) + "manage");
- // As the rootURL is missing the context, a regular test will fail
+ // As the rootURL is missing the context, a regular test will fail
assertThrows(FailingHttpStatusCodeException.class, () -> wc.getPage(request));
// When testing with the context, it will be OK, allowing to display an additional message
@@ -278,9 +278,9 @@ public void evaluate() throws Throwable {
}
private String getAdminMonitorTestUrl(JenkinsRule j) {
- return j.jenkins.getAdministrativeMonitor(ReverseProxySetupMonitor.class.getName()).getUrl() + "/test";
+ return j.jenkins.getAdministrativeMonitor(ReverseProxySetupMonitor.class.getName()).getUrl() + "/test";
}
-
+
private URL getRootUrlWithIp(JenkinsRule j) throws Exception {
return new URL(j.getURL().toString().replace("localhost", "127.0.0.1"));
}
diff --git a/test/src/test/java/hudson/diagnosis/TooManyJobsButNoViewTest.java b/test/src/test/java/hudson/diagnosis/TooManyJobsButNoViewTest.java
index 2417d9b064f7..173a1fb439f5 100644
--- a/test/src/test/java/hudson/diagnosis/TooManyJobsButNoViewTest.java
+++ b/test/src/test/java/hudson/diagnosis/TooManyJobsButNoViewTest.java
@@ -79,7 +79,7 @@ private void verifyNoForm() throws IOException, SAXException {
verifyNoForm();
}
-
+
@Test
public void systemReadNoViewAccessVerifyNoForm() throws Exception {
final String READONLY = "readonly";
@@ -104,7 +104,7 @@ private void verifyNoMonitor(JenkinsRule.WebClient wc) throws IOException, SAXEx
DomElement adminMonitorDiv = p.getElementById("tooManyJobsButNoView");
assertThat(adminMonitorDiv, is(nullValue()));
}
-
+
@Test
public void systemReadVerifyForm() throws Exception {
final String READONLY = "readonly";
@@ -132,5 +132,5 @@ private void verifyMonitor(JenkinsRule.WebClient wc) throws IOException, SAXExce
assertThat(adminMonitorDiv, is(notNullValue()));
assertThat(adminMonitorDiv.getTextContent(), is(notNullValue()));
}
-
+
}
diff --git a/test/src/test/java/hudson/init/InitMilestoneTest.java b/test/src/test/java/hudson/init/InitMilestoneTest.java
index 3783915ed36d..b46033b4ae4a 100644
--- a/test/src/test/java/hudson/init/InitMilestoneTest.java
+++ b/test/src/test/java/hudson/init/InitMilestoneTest.java
@@ -27,7 +27,7 @@ public void testInitMilestones() {
}
// Using @Initializer in static methods to check all the InitMilestones are loaded in all tests instances and make them fail,
- // so using a TestExtension and checking only the InitMilestone after EXTENSION_AUGMENTED
+ // so using a TestExtension and checking only the InitMilestone after EXTENSION_AUGMENTED
@TestExtension("testInitMilestones")
public static class Initializers {
private int order = 0;
diff --git a/test/src/test/java/hudson/jobs/CreateItemTest.java b/test/src/test/java/hudson/jobs/CreateItemTest.java
index af9019e35637..3de0a3c53132 100644
--- a/test/src/test/java/hudson/jobs/CreateItemTest.java
+++ b/test/src/test/java/hudson/jobs/CreateItemTest.java
@@ -105,8 +105,8 @@ public void vetoCreateItemFromCopy() throws Exception {
.withThrowExceptionOnFailingStatusCode(false)
.getPage(request);
- assertEquals("Creating job from copy should fail.",
- HttpURLConnection.HTTP_BAD_REQUEST,
+ assertEquals("Creating job from copy should fail.",
+ HttpURLConnection.HTTP_BAD_REQUEST,
p.getWebResponse().getStatusCode());
assertThat(rule.jenkins.getItem("newJob"), nullValue());
}
diff --git a/test/src/test/java/hudson/logging/LogRecorderManagerTest.java b/test/src/test/java/hudson/logging/LogRecorderManagerTest.java
index 641c6fd1a2da..f7fb8341c164 100644
--- a/test/src/test/java/hudson/logging/LogRecorderManagerTest.java
+++ b/test/src/test/java/hudson/logging/LogRecorderManagerTest.java
@@ -24,17 +24,22 @@
package hudson.logging;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import hudson.model.Computer;
import hudson.remoting.VirtualChannel;
import java.io.IOException;
+import java.net.HttpURLConnection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -70,6 +75,16 @@ public class LogRecorderManagerTest {
assertEquals(Level.FINEST, logger.getLevel());
}
+ @Test public void loggerConfigNotFound() throws Exception {
+ HtmlPage page = j.createWebClient().goTo("log/levels");
+ HtmlForm form = page.getFormByName("configLogger");
+ form.getInputByName("name").setValueAttribute("foo.bar.zot");
+ form.getSelectByName("level").getOptionByValue("finest").setSelected(true);
+ FailingHttpStatusCodeException e = assertThrows(FailingHttpStatusCodeException.class, () -> j.submit(form));
+ assertThat(e.getStatusCode(), equalTo(HttpURLConnection.HTTP_BAD_REQUEST));
+ assertThat(e.getResponse().getContentAsString(), containsString("A logger named \"foo.bar.zot\" does not exist"));
+ }
+
@Issue({"JENKINS-18274", "JENKINS-63458"})
@Test public void loggingOnSlaves() throws Exception {
// TODO could also go through WebClient to assert that the config UI works
diff --git a/test/src/test/java/hudson/model/AbstractBuildTest.java b/test/src/test/java/hudson/model/AbstractBuildTest.java
index 12744e3a7f3d..6c0f2afe44b7 100644
--- a/test/src/test/java/hudson/model/AbstractBuildTest.java
+++ b/test/src/test/java/hudson/model/AbstractBuildTest.java
@@ -76,35 +76,35 @@ public class AbstractBuildTest {
@ClassRule
public static BuildWatcher buildWatcher = new BuildWatcher();
-
+
@Rule
public JenkinsRule j = new JenkinsRule();
-
+
@Test
@Issue("JENKINS-30730")
public void reportErrorShouldNotFailForNonPublisherClass() throws Exception {
FreeStyleProject prj = j.createFreeStyleProject();
ErroneousJobProperty erroneousJobProperty = new ErroneousJobProperty();
prj.addProperty(erroneousJobProperty);
- QueueTaskFuture future = prj.scheduleBuild2(0);
+ QueueTaskFuture future = prj.scheduleBuild2(0);
assertThat("Build should be actually scheduled by Jenkins", future, notNullValue());
FreeStyleBuild build = future.get();
j.assertLogContains(ErroneousJobProperty.ERROR_MESSAGE, build);
j.assertLogNotContains(ClassCastException.class.getName(), build);
}
-
+
/**
* Job property, which always fails with an exception.
*/
public static class ErroneousJobProperty extends JobProperty {
public static final String ERROR_MESSAGE = "This publisher fails by design";
-
+
@Override
public boolean perform(AbstractBuild, ?> build, Launcher launcher, BuildListener listener) throws IOException {
throw new IOException(ERROR_MESSAGE);
}
-
+
@TestExtension("reportErrorShouldNotFailForNonPublisherClass")
public static class DescriptorImpl extends JobPropertyDescriptor {}
}
@@ -118,10 +118,10 @@ public void variablesResolved() throws Exception {
j.buildAndAssertSuccess(project);
- EnvVars envVars = builder.getEnvVars();
- assertEquals("value", envVars.get("KEY1"));
- assertEquals("value", envVars.get("KEY2"));
- }
+ EnvVars envVars = builder.getEnvVars();
+ assertEquals("value", envVars.get("KEY1"));
+ assertEquals("value", envVars.get("KEY2"));
+ }
/**
* Makes sure that raw console output doesn't get affected by XML escapes.
diff --git a/test/src/test/java/hudson/model/BuildExecutionTest.java b/test/src/test/java/hudson/model/BuildExecutionTest.java
index 6effa4f5ee73..8505dae809dd 100644
--- a/test/src/test/java/hudson/model/BuildExecutionTest.java
+++ b/test/src/test/java/hudson/model/BuildExecutionTest.java
@@ -51,7 +51,7 @@ public class BuildExecutionTest {
assertEquals(ws, lease.path);
}
}
-
+
private static class BrokenPublisher extends Notifier {
@Override public boolean needsToRunAfterFinalized() {
throw new IllegalStateException("oops");
diff --git a/test/src/test/java/hudson/model/ComputerTest.java b/test/src/test/java/hudson/model/ComputerTest.java
index e2262cfdabfc..2cef1e4837ba 100644
--- a/test/src/test/java/hudson/model/ComputerTest.java
+++ b/test/src/test/java/hudson/model/ComputerTest.java
@@ -98,7 +98,7 @@ public void testProhibitRenameOverExistingNode() throws Exception {
Page page = j.submit(form);
assertEquals(NOTE, HttpURLConnection.HTTP_BAD_REQUEST, page.getWebResponse().getStatusCode());
- assertThat(NOTE, page.getWebResponse().getContentAsString(),
+ assertThat(NOTE, page.getWebResponse().getContentAsString(),
containsString("Agent called ‘nodeA’ already exists"));
}
diff --git a/test/src/test/java/hudson/model/DependencyGraphTest.java b/test/src/test/java/hudson/model/DependencyGraphTest.java
index e37712cda353..02e2e49c0c42 100644
--- a/test/src/test/java/hudson/model/DependencyGraphTest.java
+++ b/test/src/test/java/hudson/model/DependencyGraphTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Alan Harder
- *
+ *
* 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
diff --git a/test/src/test/java/hudson/model/DirectoryBrowserSupportTest.java b/test/src/test/java/hudson/model/DirectoryBrowserSupportTest.java
index 528d99fe93a8..2ffa6c8cb60e 100644
--- a/test/src/test/java/hudson/model/DirectoryBrowserSupportTest.java
+++ b/test/src/test/java/hudson/model/DirectoryBrowserSupportTest.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -255,7 +255,7 @@ public void zipDownloadFileLeakMx() throws Exception {
long finalOpenFds = getOpenFdCount();
if (finalOpenFds < initialOpenFds + numOfClicks) {
- // when there was a file leak, the number of open file handle was always
+ // when there was a file leak, the number of open file handle was always
// greater or equal to the number of download
// in reverse, since the correction, the likelihood to overpass the limit was less than 1%
freeFromLeak = true;
diff --git a/test/src/test/java/hudson/model/DisplayNameTest.java b/test/src/test/java/hudson/model/DisplayNameTest.java
index 1f1dd1d6c21a..7df1a5255bb3 100644
--- a/test/src/test/java/hudson/model/DisplayNameTest.java
+++ b/test/src/test/java/hudson/model/DisplayNameTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright 2011 Yahoo!, Inc.
- *
+ *
* 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
@@ -47,11 +47,11 @@ public void testRenameJobWithNoDisplayName() throws Exception {
final String newProjectName = "newProjectName";
FreeStyleProject project = j.createFreeStyleProject(projectName);
assertEquals(projectName, project.getDisplayName());
-
+
project.renameTo(newProjectName);
assertEquals(newProjectName, project.getDisplayName());
}
-
+
@Test
public void testRenameJobWithDisplayName() throws Exception {
final String projectName = "projectName";
@@ -60,11 +60,11 @@ public void testRenameJobWithDisplayName() throws Exception {
FreeStyleProject project = j.createFreeStyleProject(projectName);
project.setDisplayName(displayName);
assertEquals(displayName, project.getDisplayName());
-
+
project.renameTo(newProjectName);
assertEquals(displayName, project.getDisplayName());
}
-
+
@SuppressWarnings("rawtypes")
@Test
public void testCopyJobWithNoDisplayName() throws Exception {
@@ -77,7 +77,7 @@ public void testCopyJobWithNoDisplayName() throws Exception {
assertEquals(newProjectName, newProject.getName());
assertEquals(newProjectName, newProject.getDisplayName());
}
-
+
@SuppressWarnings("rawtypes")
@Test
public void testCopyJobWithDisplayName() throws Exception {
@@ -91,7 +91,7 @@ public void testCopyJobWithDisplayName() throws Exception {
AbstractProject newProject = Jenkins.get().copy((AbstractProject)project, newProjectName);
assertEquals(newProjectName, newProject.getName());
assertEquals(newProjectName, newProject.getDisplayName());
-
+
}
@Issue("JENKINS-18074")
diff --git a/test/src/test/java/hudson/model/FileParameterValueTest.java b/test/src/test/java/hudson/model/FileParameterValueTest.java
index 519338a08e87..f282596f4314 100644
--- a/test/src/test/java/hudson/model/FileParameterValueTest.java
+++ b/test/src/test/java/hudson/model/FileParameterValueTest.java
@@ -55,39 +55,39 @@
public class FileParameterValueTest {
@Rule
public JenkinsRule j = new JenkinsRule();
-
+
@Rule
public TemporaryFolder tmp = new TemporaryFolder();
-
+
@Test
@Issue("SECURITY-1074")
public void fileParameter_cannotCreateFile_outsideOfBuildFolder() throws Exception {
// you can test the behavior before the correction by setting FileParameterValue.ALLOW_FOLDER_TRAVERSAL_OUTSIDE_WORKSPACE to true
-
+
FilePath root = j.jenkins.getRootPath();
-
+
FreeStyleProject p = j.createFreeStyleProject();
p.addProperty(new ParametersDefinitionProperty(Collections.singletonList(
new FileParameterDefinition("../../../../../root-level.txt", null)
)));
-
+
assertThat(root.child("root-level.txt").exists(), equalTo(false));
-
+
String uploadedContent = "test-content";
File uploadedFile = tmp.newFile();
FileUtils.write(uploadedFile, uploadedContent, StandardCharsets.UTF_8);
-
+
FreeStyleBuild build = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(
new FileParameterValue("../../../../../root-level.txt", uploadedFile, "uploaded-file.txt")
)).get();
-
+
assertThat(build.getResult(), equalTo(Result.FAILURE));
assertThat(root.child("root-level.txt").exists(), equalTo(false));
-
+
// ensure also the file is not reachable by request
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
-
+
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/..%2F..%2F..%2F..%2F..%2Froot-level.txt/uploaded-file.txt", uploadedContent);
// encoding dots
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/%2E%2E%2F%2E%2E%2F%2E%2E%2F%2E%2E%2F%2E%2E%2Froot-level.txt/uploaded-file.txt", uploadedContent);
@@ -161,132 +161,132 @@ private void checkUrlNot200AndNotContains(JenkinsRule.WebClient wc, String url,
assertThat(pageForEncoded.getWebResponse().getStatusCode(), not(equalTo(200)));
assertThat(pageForEncoded.getWebResponse().getContentAsString(), not(containsString(contentNotPresent)));
}
-
+
@Test
@Issue("SECURITY-1074")
public void fileParameter_cannotCreateFile_outsideOfBuildFolder_backslashEdition() throws Exception {
Assume.assumeTrue("Backslashes are only dangerous on Windows", Functions.isWindows());
-
+
// you can test the behavior before the correction by setting FileParameterValue.ALLOW_FOLDER_TRAVERSAL_OUTSIDE_WORKSPACE to true
-
+
FilePath root = j.jenkins.getRootPath();
-
+
FreeStyleProject p = j.createFreeStyleProject();
p.addProperty(new ParametersDefinitionProperty(Collections.singletonList(
new FileParameterDefinition("..\\..\\..\\..\\..\\root-level.txt", null)
)));
-
+
assertThat(root.child("root-level.txt").exists(), equalTo(false));
-
+
String uploadedContent = "test-content";
File uploadedFile = tmp.newFile();
FileUtils.write(uploadedFile, uploadedContent, StandardCharsets.UTF_8);
-
+
FreeStyleBuild build = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(
new FileParameterValue("..\\..\\..\\..\\..\\root-level.txt", uploadedFile, "uploaded-file.txt")
)).get();
-
+
assertThat(build.getResult(), equalTo(Result.FAILURE));
assertThat(root.child("root-level.txt").exists(), equalTo(false));
-
+
// ensure also the file is not reachable by request
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
-
+
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/..\\..\\..\\..\\..\\root-level.txt/uploaded-file.txt", uploadedContent);
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/..%2F..%2F..%2F..%2F..%2Froot-level.txt/uploaded-file.txt", uploadedContent);
}
-
+
@Test
@Issue("SECURITY-1074")
public void fileParameter_withSingleDot() throws Exception {
// this case was not working even before the patch
-
+
FreeStyleProject p = j.createFreeStyleProject();
p.addProperty(new ParametersDefinitionProperty(Collections.singletonList(
new FileParameterDefinition(".", null)
)));
-
+
String uploadedContent = "test-content";
File uploadedFile = tmp.newFile();
FileUtils.write(uploadedFile, uploadedContent, StandardCharsets.UTF_8);
-
+
FreeStyleBuild build = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(
new FileParameterValue(".", uploadedFile, "uploaded-file.txt")
)).get();
-
+
assertThat(build.getResult(), equalTo(Result.FAILURE));
-
+
// ensure also the file is not reachable by request
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
-
+
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/uploaded-file.txt", uploadedContent);
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/./uploaded-file.txt", uploadedContent);
}
-
+
@Test
@Issue("SECURITY-1074")
public void fileParameter_withDoubleDot() throws Exception {
// this case was not working even before the patch
-
+
FreeStyleProject p = j.createFreeStyleProject();
p.addProperty(new ParametersDefinitionProperty(Collections.singletonList(
new FileParameterDefinition("..", null)
)));
-
+
String uploadedContent = "test-content";
File uploadedFile = tmp.newFile();
FileUtils.write(uploadedFile, uploadedContent, StandardCharsets.UTF_8);
-
+
FreeStyleBuild build = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(
new FileParameterValue("..", uploadedFile, "uploaded-file.txt")
)).get();
-
+
assertThat(build.getResult(), equalTo(Result.FAILURE));
-
+
// ensure also the file is not reachable by request
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
-
+
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/uploaded-file.txt", uploadedContent);
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/../uploaded-file.txt", uploadedContent);
}
-
+
@Test
@Issue("SECURITY-1074")
public void fileParameter_cannotEraseFile_outsideOfBuildFolder() throws Exception {
// you can test the behavior before the correction by setting FileParameterValue.ALLOW_FOLDER_TRAVERSAL_OUTSIDE_WORKSPACE to true
-
+
FilePath root = j.jenkins.getRootPath();
-
+
FreeStyleProject p = j.createFreeStyleProject();
p.addProperty(new ParametersDefinitionProperty(Collections.singletonList(
new FileParameterDefinition("../../../../../root-level.txt", null)
)));
-
+
assertThat(root.child("root-level.txt").exists(), equalTo(false));
String initialContent = "do-not-erase-me";
root.child("root-level.txt").write(initialContent, StandardCharsets.UTF_8.name());
-
+
String uploadedContent = "test-content";
File uploadedFile = tmp.newFile();
FileUtils.write(uploadedFile, uploadedContent, StandardCharsets.UTF_8);
-
+
FreeStyleBuild build = p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(
new FileParameterValue("../../../../../root-level.txt", uploadedFile, "uploaded-file.txt")
)).get();
-
+
assertThat(build.getResult(), equalTo(Result.FAILURE));
assertThat(root.child("root-level.txt").readToString(), equalTo(initialContent));
-
+
// ensure also the file is not reachable by request
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
-
+
checkUrlNot200AndNotContains(wc, build.getUrl() + "parameters/parameter/..%2F..%2F..%2F..%2F..%2Froot-level.txt/uploaded-file.txt", uploadedContent);
}
-
+
@Test
public void fileParameter_canStillUse_internalHierarchy() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
@@ -294,28 +294,28 @@ public void fileParameter_canStillUse_internalHierarchy() throws Exception {
new FileParameterDefinition("direct-child1.txt", null),
new FileParameterDefinition("parent/child2.txt", null)
)));
-
+
File uploadedFile1 = tmp.newFile();
FileUtils.write(uploadedFile1, "test1", StandardCharsets.UTF_8);
File uploadedFile2 = tmp.newFile();
FileUtils.write(uploadedFile2, "test2", StandardCharsets.UTF_8);
-
+
FreeStyleBuild build = j.assertBuildStatusSuccess(p.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(
new FileParameterValue("direct-child1.txt", uploadedFile1, "uploaded-file-1.txt"),
new FileParameterValue("parent/child2.txt", uploadedFile2, "uploaded-file-2.txt")
)));
-
+
// files are correctly saved in the build "fileParameters" folder
File directChild = new File(build.getRootDir(), "fileParameters/" + "direct-child1.txt");
assertTrue(directChild.exists());
-
+
File parentChild = new File(build.getRootDir(), "fileParameters/" + "parent/child2.txt");
assertTrue(parentChild.exists());
-
+
// both are correctly copied inside the workspace
assertTrue(build.getWorkspace().child("direct-child1.txt").exists());
assertTrue(build.getWorkspace().child("parent").child("child2.txt").exists());
-
+
// and reachable using request
JenkinsRule.WebClient wc = j.createWebClient();
HtmlPage workspacePage = wc.goTo(p.getUrl() + "ws");
diff --git a/test/src/test/java/hudson/model/FingerprintTest.java b/test/src/test/java/hudson/model/FingerprintTest.java
index 03b0f3d4b39c..94c3c33fdc8f 100644
--- a/test/src/test/java/hudson/model/FingerprintTest.java
+++ b/test/src/test/java/hudson/model/FingerprintTest.java
@@ -145,10 +145,10 @@ public void shouldCreateFingerprintsForWorkspace() throws Exception {
project.getBuildersList().add(new CreateFileBuilder("test.txt", "Hello, world!"));
project.getPublishersList().add(new Fingerprinter("test.txt", false));
FreeStyleBuild build = rule.buildAndAssertSuccess(project);
-
+
Fingerprint fp = getFingerprint(build, "test.txt");
}
-
+
@Test
public void shouldCreateFingerprintsForArtifacts() throws Exception {
FreeStyleProject project = rule.createFreeStyleProject();
@@ -157,32 +157,32 @@ public void shouldCreateFingerprintsForArtifacts() throws Exception {
archiver.setFingerprint(true);
project.getPublishersList().add(archiver);
FreeStyleBuild build = rule.buildAndAssertSuccess(project);
-
+
Fingerprint fp = getFingerprint(build, "test.txt");
}
-
+
@Test
public void shouldCreateUsageLinks() throws Exception {
- // Project 1
+ // Project 1
FreeStyleProject project = createAndRunProjectWithPublisher("fpProducer", "test.txt");
final FreeStyleBuild build = project.getLastBuild();
-
+
// Project 2
FreeStyleProject project2 = rule.createFreeStyleProject();
project2.getBuildersList().add(new WorkspaceCopyFileBuilder("test.txt", project.getName(), build.getNumber()));
project2.getPublishersList().add(new Fingerprinter("test.txt"));
FreeStyleBuild build2 = rule.buildAndAssertSuccess(project2);
-
+
Fingerprint fp = getFingerprint(build, "test.txt");
-
+
// Check references
Fingerprint.BuildPtr original = fp.getOriginal();
assertEquals("Original reference contains a wrong job name", project.getName(), original.getName());
assertEquals("Original reference contains a wrong build number", build.getNumber(), original.getNumber());
-
+
Hashtable usages = fp.getUsages();
assertTrue("Usages do not have a reference to " + project, usages.containsKey(project.getName()));
- assertTrue("Usages do not have a reference to " + project2, usages.containsKey(project2.getName()));
+ assertTrue("Usages do not have a reference to " + project2, usages.containsKey(project2.getName()));
}
@Test
@@ -198,28 +198,28 @@ public void shouldThrowIOExceptionWhenFileIsInvalid() throws Exception {
}
fail("Expected IOException");
}
-
+
@Test
@Issue("SECURITY-153")
public void shouldBeUnableToSeeJobsIfNoPermissions() throws Exception {
- // Project 1
+ // Project 1
final FreeStyleProject project1 = createAndRunProjectWithPublisher("fpProducer", "test.txt");
final FreeStyleBuild build = project1.getLastBuild();
-
+
// Project 2
final FreeStyleProject project2 = rule.createFreeStyleProject("project2");
project2.getBuildersList().add(new WorkspaceCopyFileBuilder("test.txt", project1.getName(), build.getNumber()));
project2.getPublishersList().add(new Fingerprinter("test.txt"));
final FreeStyleBuild build2 = rule.buildAndAssertSuccess(project2);
-
+
// Get fingerprint
final Fingerprint fp = getFingerprint(build, "test.txt");
-
+
// Init Users
User user1 = User.getOrCreateByIdOrFullName("user1"); // can access project1
User user2 = User.getOrCreateByIdOrFullName("user2"); // can access project2
User user3 = User.getOrCreateByIdOrFullName("user3"); // cannot access anything
-
+
// Project permissions
setupProjectMatrixAuthStrategy(Jenkins.READ);
setJobPermissionsOnce(project1, "user1", Item.READ, Item.DISCOVER);
@@ -246,16 +246,16 @@ public void shouldBeUnableToSeeJobsIfNoPermissions() throws Exception {
assertEquals("All usages should be invisible for user3", 0, fp._getUsages().size());
}
}
-
+
@Test
public void shouldBeAbleToSeeOriginalWithDiscoverPermissionOnly() throws Exception {
// Setup the environment
final FreeStyleProject project = createAndRunProjectWithPublisher("project", "test.txt");
final FreeStyleBuild build = project.getLastBuild();
final Fingerprint fingerprint = getFingerprint(build, "test.txt");
-
+
// Init Users and security
- User user1 = User.get("user1");
+ User user1 = User.get("user1");
setupProjectMatrixAuthStrategy(Jenkins.READ, Item.DISCOVER);
try (ACLContext acl = ACL.as(user1)) {
@@ -266,20 +266,20 @@ public void shouldBeAbleToSeeOriginalWithDiscoverPermissionOnly() throws Excepti
assertEquals("Usage ref in fingerprint should be visible to user1", 1, fingerprint._getUsages().size());
}
}
-
+
@Test
public void shouldBeAbleToSeeFingerprintsInReadableFolder() throws Exception {
final SecuredMockFolder folder = rule.jenkins.createProject(SecuredMockFolder.class, "folder");
final FreeStyleProject project = createAndRunProjectWithPublisher(folder, "project", "test.txt");
final FreeStyleBuild build = project.getLastBuild();
final Fingerprint fingerprint = getFingerprint(build, "test.txt");
-
+
// Init Users and security
User user1 = User.getOrCreateByIdOrFullName("user1");
setupProjectMatrixAuthStrategy(false, Jenkins.READ, Item.DISCOVER);
setJobPermissionsOnce(project, "user1", Item.DISCOVER); // Prevents the fallback to the folder ACL
folder.setPermissions("user1", Item.READ);
-
+
// Ensure we can read the original from user account
try (ACLContext acl = ACL.as(user1)) {
assertTrue("Test framework issue: User1 should be able to read the folder", folder.hasPermission(Item.READ));
@@ -293,18 +293,18 @@ public void shouldBeAbleToSeeFingerprintsInReadableFolder() throws Exception {
assertThat("User should be unable do retrieve the job due to the missing read", original.getJob(), nullValue());
}
}
-
+
@Test
public void shouldBeUnableToSeeFingerprintsInUnreadableFolder() throws Exception {
final SecuredMockFolder folder = rule.jenkins.createProject(SecuredMockFolder.class, "folder");
final FreeStyleProject project = createAndRunProjectWithPublisher(folder, "project", "test.txt");
final FreeStyleBuild build = project.getLastBuild();
final Fingerprint fingerprint = getFingerprint(build, "test.txt");
-
+
// Init Users and security
User user1 = User.getOrCreateByIdOrFullName("user1"); // can access project1
setupProjectMatrixAuthStrategy(Jenkins.READ, Item.DISCOVER);
-
+
// Ensure we can read the original from user account
try (ACLContext acl = ACL.as(user1)) {
assertFalse("Test framework issue: User1 should be unable to read the folder", folder.hasPermission(Item.READ));
@@ -312,7 +312,7 @@ public void shouldBeUnableToSeeFingerprintsInUnreadableFolder() throws Exception
assertEquals("No jobs should be visible to user1", 0, fingerprint._getUsages().size());
}
}
-
+
/**
* A common non-admin user should not be able to see references to a
* deleted job even if he used to have READ permissions before the deletion.
@@ -325,7 +325,7 @@ public void commonUserShouldBeUnableToSeeReferencesOfDeletedJobs() throws Except
FreeStyleProject project = createAndRunProjectWithPublisher("project", "test.txt");
FreeStyleBuild build = project.getLastBuild();
final Fingerprint fp = getFingerprint(build, "test.txt");
-
+
// Init Users and security
User user1 = User.getOrCreateByIdOrFullName("user1");
setupProjectMatrixAuthStrategy(Jenkins.READ, Item.READ, Item.DISCOVER);
@@ -336,14 +336,14 @@ public void commonUserShouldBeUnableToSeeReferencesOfDeletedJobs() throws Except
assertEquals("No jobs should be visible to user1", 0, fp._getUsages().size());
}
}
-
+
@Test
public void adminShouldBeAbleToSeeReferencesOfDeletedJobs() throws Exception {
// Setup the environment
final FreeStyleProject project = createAndRunProjectWithPublisher("project", "test.txt");
final FreeStyleBuild build = project.getLastBuild();
final Fingerprint fingerprint = getFingerprint(build, "test.txt");
-
+
// Init Users and security
User user1 = User.getOrCreateByIdOrFullName("user1");
setupProjectMatrixAuthStrategy(Jenkins.ADMINISTER);
@@ -592,7 +592,7 @@ public void checkArbitraryFingerprintConfigFileExistenceWithWebClient() throws E
}
assertTrue(targetFile.exists());
}
-
+
@NonNull
private Fingerprint getFingerprint(@CheckForNull Run, ?> run, @NonNull String filename) {
assertNotNull("Input run is null", run);
@@ -603,15 +603,15 @@ private Fingerprint getFingerprint(@CheckForNull Run, ?> run, @NonNull String
assertNotNull("No reference to '" + filename + "' from the Fingerprint action", fp);
return fp;
}
-
+
@NonNull
- private FreeStyleProject createAndRunProjectWithPublisher(String projectName, String fpFileName)
+ private FreeStyleProject createAndRunProjectWithPublisher(String projectName, String fpFileName)
throws Exception {
return createAndRunProjectWithPublisher(null, projectName, fpFileName);
}
-
+
@NonNull
- private FreeStyleProject createAndRunProjectWithPublisher(@CheckForNull MockFolder folder,
+ private FreeStyleProject createAndRunProjectWithPublisher(@CheckForNull MockFolder folder,
String projectName, String fpFileName) throws Exception {
final FreeStyleProject project;
if (folder == null) {
@@ -626,13 +626,13 @@ private FreeStyleProject createAndRunProjectWithPublisher(@CheckForNull MockFold
rule.buildAndAssertSuccess(project);
return project;
}
-
+
private void setupProjectMatrixAuthStrategy(@NonNull Permission ... permissions) {
setupProjectMatrixAuthStrategy(true, permissions);
}
-
+
private void setupProjectMatrixAuthStrategy(boolean inheritFromFolders, @NonNull Permission ... permissions) {
- ProjectMatrixAuthorizationStrategy str = inheritFromFolders
+ ProjectMatrixAuthorizationStrategy str = inheritFromFolders
? new ProjectMatrixAuthorizationStrategy()
: new NoInheritanceProjectMatrixAuthorizationStrategy();
for (Permission p : permissions) {
@@ -644,22 +644,22 @@ private void setupProjectMatrixAuthStrategy(boolean inheritFromFolders, @NonNull
private void setJobPermissionsOnce(Job,?> job, String username, @NonNull Permission ... s)
throws IOException {
assertThat("Cannot assign the property twice", job.getProperty(AuthorizationMatrixProperty.class), nullValue());
-
+
Map> permissions = new HashMap<>();
HashSet userSpec = new HashSet<>(Collections.singletonList(username));
for (Permission p : s) {
permissions.put(p, userSpec);
}
- AuthorizationMatrixProperty property = new AuthorizationMatrixProperty(permissions);
+ AuthorizationMatrixProperty property = new AuthorizationMatrixProperty(permissions);
job.addProperty(property);
}
-
+
/**
* Security strategy, which prevents the permission inheritance from upper folders.
*/
private static class NoInheritanceProjectMatrixAuthorizationStrategy extends ProjectMatrixAuthorizationStrategy {
-
+
@Override
public ACL getACL(Job, ?> project) {
AuthorizationMatrixProperty amp = project.getProperty(AuthorizationMatrixProperty.class);
diff --git a/test/src/test/java/hudson/model/HelpLinkTest.java b/test/src/test/java/hudson/model/HelpLinkTest.java
index 4f3a2e67a6be..1b80664ec1b8 100644
--- a/test/src/test/java/hudson/model/HelpLinkTest.java
+++ b/test/src/test/java/hudson/model/HelpLinkTest.java
@@ -32,15 +32,15 @@
"Executing negative(hudson.model.HelpLinkTest)@1" prio=5 tid=0x1 nid=NA waiting
java.lang.Thread.State: WAITING
- at java.lang.Object.wait(Object.java:-1)
- at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.waitForJobs(JavaScriptJobManagerImpl.java:200)
- at com.gargoylesoftware.htmlunit.WebClient.waitForBackgroundJavaScript(WebClient.java:1843)
- at com.gargoylesoftware.htmlunit.WebClientUtil.waitForJSExec(WebClientUtil.java:57)
- at com.gargoylesoftware.htmlunit.WebClientUtil.waitForJSExec(WebClientUtil.java:46)
- at com.gargoylesoftware.htmlunit.html.HtmlElementUtil.click(HtmlElementUtil.java:61)
- at hudson.model.HelpLinkTest.clickAllHelpLinks(HelpLinkTest.java:70)
- at hudson.model.HelpLinkTest.clickAllHelpLinks(HelpLinkTest.java:61)
- at hudson.model.HelpLinkTest.negative(HelpLinkTest.java:106)
+ at java.lang.Object.wait(Object.java:-1)
+ at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.waitForJobs(JavaScriptJobManagerImpl.java:200)
+ at com.gargoylesoftware.htmlunit.WebClient.waitForBackgroundJavaScript(WebClient.java:1843)
+ at com.gargoylesoftware.htmlunit.WebClientUtil.waitForJSExec(WebClientUtil.java:57)
+ at com.gargoylesoftware.htmlunit.WebClientUtil.waitForJSExec(WebClientUtil.java:46)
+ at com.gargoylesoftware.htmlunit.html.HtmlElementUtil.click(HtmlElementUtil.java:61)
+ at hudson.model.HelpLinkTest.clickAllHelpLinks(HelpLinkTest.java:70)
+ at hudson.model.HelpLinkTest.clickAllHelpLinks(HelpLinkTest.java:61)
+ at hudson.model.HelpLinkTest.negative(HelpLinkTest.java:106)
In debugger, I can see that JavaScriptJobManagerImpl.waitForJobs is looping through yet each time getJobCount()>0
because there's always some window.setTimeout activities that appear to be scheduled. Common ones are:
diff --git a/test/src/test/java/hudson/model/ItemsTest.java b/test/src/test/java/hudson/model/ItemsTest.java
index 2bbc7b23f5a6..ab1cc3cb7ced 100644
--- a/test/src/test/java/hudson/model/ItemsTest.java
+++ b/test/src/test/java/hudson/model/ItemsTest.java
@@ -70,7 +70,7 @@ public class ItemsTest {
public void setupLegacyBehavior(){
ApiTokenTestHelper.enableLegacyBehavior();
}
-
+
@Test public void getAllItems() throws Exception {
MockFolder d = r.createFolder("d");
MockFolder sub2 = d.createProject(MockFolder.class, "sub2");
@@ -171,7 +171,7 @@ public void allItems() throws Exception {
assertFalse(new File(tmp, "foo/test/1").exists());
assertTrue(new File(tmp, "bar/test/1").exists());
}
-
+
// TODO would be more efficient to run these all as a single test case, but after a few Jetty seems to stop serving new content and new requests just hang.
private void overwriteTargetSetUp() throws Exception {
diff --git a/test/src/test/java/hudson/model/JobTest.java b/test/src/test/java/hudson/model/JobTest.java
index 926e8c85f479..70f7a9c726ad 100644
--- a/test/src/test/java/hudson/model/JobTest.java
+++ b/test/src/test/java/hudson/model/JobTest.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
* Copyright (c) 2015 Christopher Simons
- *
+ *
* 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
@@ -87,7 +87,7 @@ public class JobTest {
@Test public void jobPropertySummaryIsShownInMainPage() throws Exception {
AbstractProject project = j.createFreeStyleProject();
project.addProperty(new JobPropertyImpl("NeedleInPage"));
-
+
HtmlPage page = j.createWebClient().getPage(project);
WebAssert.assertTextPresent(page, "NeedleInPage");
}
@@ -184,11 +184,11 @@ public void run() {
public static class JobPropertyImpl extends JobProperty> {
public static DescriptorImpl DESCRIPTOR = new DescriptorImpl();
private final String testString;
-
+
public JobPropertyImpl(String testString) {
this.testString = testString;
}
-
+
public String getTestString() {
return testString;
}
@@ -224,7 +224,7 @@ public String getDisplayName() {
@LocalData
@Test public void configDotXmlPermission() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
j.jenkins.setCrumbIssuer(null);
JenkinsRule.WebClient wc = j.createWebClient();
boolean saveEnabled = Item.EXTENDED_READ.getEnabled();
@@ -233,17 +233,17 @@ public String getDisplayName() {
wc.assertFails("job/testJob/config.xml", HttpURLConnection.HTTP_FORBIDDEN);
wc.setThrowExceptionOnFailingStatusCode(false);
-
+
// Has CONFIGURE and EXTENDED_READ permission
- wc.withBasicApiToken(User.getById("alice", true));
+ wc.withBasicApiToken(User.getById("alice", true));
tryConfigDotXml(wc, HttpURLConnection.HTTP_INTERNAL_ERROR, "Both perms; should get 500");
// Has only CONFIGURE permission (this should imply EXTENDED_READ)
- wc.withBasicApiToken(User.getById("bob", true));
+ wc.withBasicApiToken(User.getById("bob", true));
tryConfigDotXml(wc, HttpURLConnection.HTTP_INTERNAL_ERROR, "Config perm should imply EXTENDED_READ");
// Has only EXTENDED_READ permission
- wc.withBasicApiToken(User.getById("charlie", true));
+ wc.withBasicApiToken(User.getById("charlie", true));
tryConfigDotXml(wc, HttpURLConnection.HTTP_FORBIDDEN, "No permission, should get 403");
} finally {
Item.EXTENDED_READ.setEnabled(saveEnabled);
@@ -254,13 +254,13 @@ private static void tryConfigDotXml(JenkinsRule.WebClient wc, int status, String
// Verify we can GET the config.xml:
Page p = wc.goTo("job/testJob/config.xml", "application/xml");
assertEquals("Retrieving config.xml should be ok", HttpURLConnection.HTTP_OK, p.getWebResponse().getStatusCode());
-
+
// This page is a simple form to POST to /job/testJob/config.xml
// But it posts invalid data so we expect 500 if we have permission, 403 if not
HtmlPage page = wc.goTo("userContent/post.html");
p = HtmlFormUtil.submit(page.getForms().get(0));
assertEquals(msg, status, p.getWebResponse().getStatusCode());
-
+
p = wc.goTo("logout");
assertEquals("To logout should be ok", HttpURLConnection.HTTP_OK, p.getWebResponse().getStatusCode());
}
@@ -286,7 +286,7 @@ private static void tryConfigDotXml(JenkinsRule.WebClient wc, int status, String
project.setDescription(null);
assertEquals("", ((TextPage) wc.goTo("job/project/description", "text/plain")).getContent());
}
-
+
@Test public void projectNamingStrategy() throws Exception {
j.jenkins.setProjectNamingStrategy(new ProjectNamingStrategy.PatternProjectNamingStrategy("DUMMY.*", false));
try {
diff --git a/test/src/test/java/hudson/model/ListViewTest.java b/test/src/test/java/hudson/model/ListViewTest.java
index 1ed5dc322d86..4cc6e2b76007 100644
--- a/test/src/test/java/hudson/model/ListViewTest.java
+++ b/test/src/test/java/hudson/model/ListViewTest.java
@@ -87,7 +87,7 @@ public class ListViewTest {
@Test public void nullJobNames() {
assertTrue(j.jenkins.getView("v").getItems().isEmpty());
}
-
+
@Test
public void testJobLinksAreValid() throws Exception {
/*
@@ -101,7 +101,7 @@ public void testJobLinksAreValid() throws Exception {
FreeStyleProject job1 = folder1.createProject(FreeStyleProject.class, "job1");
MockFolder folder2 = folder1.createProject(MockFolder.class, "folder2");
FreeStyleProject job2 = folder2.createProject(FreeStyleProject.class, "job2");
-
+
ListView lv = new ListView("myview");
lv.setRecurse(true);
lv.setIncludeRegex(".*");
@@ -119,7 +119,7 @@ public void testJobLinksAreValid() throws Exception {
checkLinkFromItemExistsAndIsValid(folder2, folder1, folder1, webClient);
checkLinkFromViewExistsAndIsValid(job2, folder1, lv2, webClient);
}
-
+
private void checkLinkFromViewExistsAndIsValid(Item item, ItemGroup ig, View view, WebClient webClient) throws IOException, SAXException {
HtmlPage page = webClient.goTo(view.getUrl());
HtmlAnchor link = page.getAnchorByText(Functions.getRelativeDisplayNameFrom(item, ig));
diff --git a/test/src/test/java/hudson/model/MyViewTest.java b/test/src/test/java/hudson/model/MyViewTest.java
index efac83311e09..15b6a2bd4a76 100644
--- a/test/src/test/java/hudson/model/MyViewTest.java
+++ b/test/src/test/java/hudson/model/MyViewTest.java
@@ -49,7 +49,7 @@
* @author Lucie Votypkova
*/
public class MyViewTest {
-
+
@Rule
public JenkinsRule rule = new JenkinsRule();
@@ -60,11 +60,11 @@ public class MyViewTest {
public void setup() {
rule.jenkins.setSecurityRealm(rule.createDummySecurityRealm());
}
-
+
@Test
public void testContains() throws Exception{
-
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
rule.jenkins.setAuthorizationStrategy(auth);
User user = User.getOrCreateByIdOrFullName("User1");
FreeStyleProject job = rule.createFreeStyleProject("job");
@@ -76,7 +76,7 @@ public void testContains() throws Exception{
auth.add(Item.CONFIGURE, "User1");
assertTrue("View " + view.getDisplayName() + " contain job " + job.getDisplayName(), view.contains(job));
}
-
+
@Test
public void testDoCreateItem() throws Exception{
logs.record(AbstractItem.class, Level.ALL);
@@ -95,12 +95,12 @@ public void testDoCreateItem() throws Exception{
assumeThat("TODO sometimes on Windows CI the submission does not seem to be really processed (most log messages are missing)", item, notNullValue());
assertThat(view.getItems(), contains(equalTo(item)));
}
-
+
@Test
public void testGetItems() throws IOException {
User user = User.getOrCreateByIdOrFullName("User1");
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
- rule.jenkins.setAuthorizationStrategy(auth);
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ rule.jenkins.setAuthorizationStrategy(auth);
FreeStyleProject job2 = rule.createFreeStyleProject("job2");
FreeStyleProject job = rule.createFreeStyleProject("job");
MyView view = new MyView("My", rule.jenkins);
@@ -112,6 +112,6 @@ public void testGetItems() throws IOException {
assertTrue("View " + view.getDisplayName() + " should contain job " + job.getDisplayName(), view.getItems().contains(job));
assertTrue("View " + view.getDisplayName() + " should contain job " + job2.getDisplayName(), view.getItems().contains(job2));
}
-
-
+
+
}
diff --git a/test/src/test/java/hudson/model/MyViewsPropertyTest.java b/test/src/test/java/hudson/model/MyViewsPropertyTest.java
index 935ed5ab36de..372643d60cff 100644
--- a/test/src/test/java/hudson/model/MyViewsPropertyTest.java
+++ b/test/src/test/java/hudson/model/MyViewsPropertyTest.java
@@ -47,10 +47,10 @@
* @author Lucie Votypkova
*/
public class MyViewsPropertyTest {
-
+
@Rule
public JenkinsRule rule = new JenkinsRule();
-
+
@Test
public void testReadResolve() throws IOException {
User user = User.getOrCreateByIdOrFullName("User");
@@ -84,7 +84,7 @@ public void testSave() throws IOException {
assertEquals("Property should have primary view " + view.name + " instead of " + property.getPrimaryViewName(), view.name, property.getPrimaryViewName());
}
*/
-
+
@Test
public void testGetViews() throws IOException {
User user = User.getOrCreateByIdOrFullName("User");
@@ -96,7 +96,7 @@ public void testGetViews() throws IOException {
property.addView(view);
assertTrue("Property should contain " + view.name, property.getViews().contains(view));
}
-
+
@Test
public void testGetView() throws IOException {
User user = User.getOrCreateByIdOrFullName("User");
@@ -109,7 +109,7 @@ public void testGetView() throws IOException {
property.addView(view);
assertEquals("Property should contain " + view.name, view, property.getView(view.name));
}
-
+
@Test
public void testGetPrimaryView() throws IOException {
User user = User.getOrCreateByIdOrFullName("User");
@@ -123,7 +123,7 @@ public void testGetPrimaryView() throws IOException {
property.setPrimaryViewName(view.name);
assertEquals("Property should have primary view " + view.name + " instead of " + property.getPrimaryView().name, view, property.getPrimaryView());
}
-
+
@Test
public void testCanDelete() throws IOException {
User user = User.getOrCreateByIdOrFullName("User");
@@ -183,8 +183,8 @@ public void testOnViewRenamed() throws IOException, FormException {
View view = new ListView("foo", property);
property.addView(view);
property.setPrimaryViewName(view.name);
- view.rename("primary-renamed");
- assertEquals("Property should rename its primary view ", "primary-renamed", property.getPrimaryViewName());
+ view.rename("primary-renamed");
+ assertEquals("Property should rename its primary view ", "primary-renamed", property.getPrimaryViewName());
}
@Test
@@ -219,7 +219,7 @@ public void testDoCreateView() throws Exception {
form.getInputByName("name").setValueAttribute("foo");
form.getRadioButtonsByName("mode").get(0).setChecked(true);
rule.submit(form);
- assertNotNull("Property should contain view foo", property.getView("foo"));
+ assertNotNull("Property should contain view foo", property.getView("foo"));
}
rule.jenkins.reload();
{
@@ -248,8 +248,8 @@ public void testCheckPermission() throws IOException {
MyViewsProperty property = new MyViewsProperty(AllView.DEFAULT_VIEW_NAME);
property.readResolve();
property.setUser(user);
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
- rule.jenkins.setAuthorizationStrategy(auth);
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ rule.jenkins.setAuthorizationStrategy(auth);
user.addProperty(property);
boolean ex = false;
SecurityContextHolder.getContext().setAuthentication(user2.impersonate2());
@@ -285,8 +285,8 @@ public void testHasPermission() throws IOException {
MyViewsProperty property = new MyViewsProperty(AllView.DEFAULT_VIEW_NAME);
property.readResolve();
property.setUser(user);
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
- rule.jenkins.setAuthorizationStrategy(auth);
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ rule.jenkins.setAuthorizationStrategy(auth);
user.addProperty(property);
SecurityContextHolder.getContext().setAuthentication(user2.impersonate2());
assertFalse("User User2 should not configure permission for user User",property.hasPermission(Permission.CONFIGURE));
@@ -310,5 +310,5 @@ public void shouldNotFailWhenMigratingLegacyViewsWithoutPrimaryOne() throws IOEx
property.addView(new AllView("foobar"));
property.readResolve();
}
-
+
}
diff --git a/test/src/test/java/hudson/model/ParametersTest.java b/test/src/test/java/hudson/model/ParametersTest.java
index eab06e2b9d87..0fe26d4615b6 100644
--- a/test/src/test/java/hudson/model/ParametersTest.java
+++ b/test/src/test/java/hudson/model/ParametersTest.java
@@ -93,9 +93,7 @@ public void parameterTypes() throws Exception {
assertEquals("run", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'jenkins-form-label')]")).getTextContent());
j.submit(form);
- Queue.Item q = j.jenkins.getQueue().getItem(project);
- if (q != null) q.getFuture().get();
- else Thread.sleep(1000);
+ j.waitUntilNoActivity();
assertEquals("newValue", builder.getEnvVars().get("STRING"));
assertEquals("true", builder.getEnvVars().get("BOOLEAN"));
@@ -130,9 +128,7 @@ public void choiceWithLTGT() throws Exception {
opt.setSelected(true);
j.submit(form);
- Queue.Item q = j.jenkins.getQueue().getItem(project);
- if (q != null) q.getFuture().get();
- else Thread.sleep(1000);
+ j.waitUntilNoActivity();
assertNotNull(builder.getEnvVars());
assertEquals("Choice <2>", builder.getEnvVars().get("CHOICE"));
@@ -208,9 +204,7 @@ public void fileParameterNotSet() throws Exception {
HtmlForm form = page.getFormByName("parameters");
j.submit(form);
- Queue.Item q = j.jenkins.getQueue().getItem(project);
- if (q != null) q.getFuture().get();
- else Thread.sleep(1000);
+ j.waitUntilNoActivity();
assertFalse("file must not exist", project.getSomeWorkspace().child("filename").exists());
}
@@ -234,6 +228,7 @@ public void unicodeParametersArePresetCorrectly() throws Exception {
wc.setThrowExceptionOnFailingStatusCode(true);
final HtmlForm form = page.getFormByName("parameters");
HtmlFormUtil.submit(form, HtmlFormUtil.getButtonByCaption(form, "Build"));
+ j.waitUntilNoActivity();
}
@Issue("SECURITY-353")
diff --git a/test/src/test/java/hudson/model/PasswordParameterDefinitionTest.java b/test/src/test/java/hudson/model/PasswordParameterDefinitionTest.java
index 67ee5e9638eb..6541af0682a2 100644
--- a/test/src/test/java/hudson/model/PasswordParameterDefinitionTest.java
+++ b/test/src/test/java/hudson/model/PasswordParameterDefinitionTest.java
@@ -53,7 +53,7 @@ public class PasswordParameterDefinitionTest {
@Issue("JENKINS-36476")
@Test public void defaultValueAlwaysAvailable() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().
grant(Jenkins.ADMINISTER).everywhere().to("admin").
diff --git a/test/src/test/java/hudson/model/ProjectTest.java b/test/src/test/java/hudson/model/ProjectTest.java
index 2873e43a7c35..1bf57cf06a68 100644
--- a/test/src/test/java/hudson/model/ProjectTest.java
+++ b/test/src/test/java/hudson/model/ProjectTest.java
@@ -108,12 +108,12 @@
* @author Lucie Votypkova
*/
public class ProjectTest {
-
+
@Rule public JenkinsRule j = new JenkinsRule();
public static boolean createAction = false;
public static boolean getFilePath = false;
public static boolean createSubTask = false;
-
+
@Test
public void testSave() throws IOException, InterruptedException, ReactorException {
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -126,7 +126,7 @@ public void testSave() throws IOException, InterruptedException, ReactorExceptio
assertEquals("All persistent data should be saved.", 5, p.nextBuildNumber);
assertTrue("All persistent data should be saved", p.disabled);
}
-
+
@Test
public void testOnCreateFromScratch() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -138,7 +138,7 @@ public void testOnCreateFromScratch() throws Exception{
assertNotNull("Project should have transient action TransientAction.", p.getAction(TransientAction.class));
createAction = false;
}
-
+
@Test
public void testOnLoad() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -151,7 +151,7 @@ public void testOnLoad() throws Exception{
assertNotNull("Project should have Transient Action TransientAction.", p.getAction(TransientAction.class));
createAction = false;
}
-
+
@Test
public void testGetEnvironment() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -161,7 +161,7 @@ public void testGetEnvironment() throws Exception{
EnvVars var = p.getEnvironment(slave, TaskListener.NULL);
assertEquals("Environment should have set jdk.", "some_java", var.get("jdk"));
}
-
+
@Test
public void testPerformDelete() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -169,7 +169,7 @@ public void testPerformDelete() throws Exception{
assertFalse("Project should be deleted from disk.", p.getConfigFile().exists());
assertTrue("Project should be disabled when deleting start.", p.isDisabled());
}
-
+
@Test
public void testGetAssignedLabel() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -181,7 +181,7 @@ public void testGetAssignedLabel() throws Exception{
p.setAssignedLabel(slave.getSelfLabel());
assertEquals("Project should have self label of slave", slave.getSelfLabel(), p.getAssignedLabel());
}
-
+
@Test
public void testGetAssignedLabelString() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -193,7 +193,7 @@ public void testGetAssignedLabelString() throws Exception{
assertEquals("Project should return name of slave.", slave.getSelfLabel().name, p.getAssignedLabelString());
}
-
+
@Test
public void testGetSomeWorkspace() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -206,7 +206,7 @@ public void testGetSomeWorkspace() throws Exception{
j.buildAndAssertSuccess(p);
assertNotNull("Project should has any workspace.", p.getSomeWorkspace());
}
-
+
@Test
public void testGetSomeBuildWithWorkspace() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -231,7 +231,7 @@ public void testGetSomeBuildWithWorkspace() throws Exception{
p.doDoWipeOutWorkspace();
wc.assertFails("job/project/ws/some.log", 404);
}
-
+
@Test
public void testGetQuietPeriod() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -241,7 +241,7 @@ public void testGetQuietPeriod() throws IOException{
p.setQuietPeriod(10);
assertEquals("Quiet period was set.", 10, p.getQuietPeriod());
}
-
+
@Test
public void testGetScmCheckoutStrategy() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -251,7 +251,7 @@ public void testGetScmCheckoutStrategy() throws IOException{
p.setScmCheckoutStrategy(strategy);
assertEquals("Project should return its scm checkout strategy if this strategy is not null", strategy, p.getScmCheckoutStrategy());
}
-
+
@Test
public void testGetScmCheckoutRetryCount() throws Exception{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -266,7 +266,7 @@ public void testGetScmCheckoutRetryCount() throws Exception{
j.submit(form);
assertEquals("Scm retry count was set.", 7, p.getScmCheckoutRetryCount());
}
-
+
@Test
public void isBuildable() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -279,7 +279,7 @@ public void isBuildable() throws IOException{
p2.save();
assertTrue("Project should be buildable after save.", p2.isBuildable());
}
-
+
@Test
public void testMakeDisabled() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -293,7 +293,7 @@ public void testMakeDisabled() throws IOException{
p.makeDisabled(true);
assertNull("Project should be canceled.", Queue.getInstance().getItem(p));
}
-
+
@Test
public void testAddProperty() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -303,7 +303,7 @@ public void testAddProperty() throws IOException{
assertNotNull("Project does not contain added property.", p.getProperty(prop.getClass()));
assertNotNull("Project did not update transient actions.", p.getAction(TransientAction.class));
}
-
+
@Test
public void testScheduleBuild2() throws IOException, InterruptedException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -319,7 +319,7 @@ public void testScheduleBuild2() throws IOException, InterruptedException{
assertNotNull("Build should be done or in progress.", p.getLastBuild());
}
-
+
@Test
public void testSchedulePolling() throws IOException, ANTLRException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -331,7 +331,7 @@ public void testSchedulePolling() throws IOException, ANTLRException{
p.disable();
assertFalse("Project should not schedule polling because project is disabled.", p.schedulePolling());
}
-
+
@Test
public void testSaveAfterSet() throws Exception {
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -353,7 +353,7 @@ public void testSaveAfterSet() throws Exception {
assertNotNull("Project did not save jdk", p.getJDK());
assertEquals("Project did not save custom workspace.", "/some/path", p.getCustomWorkspace());
}
-
+
@Test
public void testGetActions() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -409,7 +409,7 @@ private void assertInstanceOf(String msg, Object o, Class t) {
return;
fail(msg + ": " + o);
}
-
+
@Test
public void testGetSubTasks() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -427,9 +427,9 @@ public void testGetSubTasks() throws IOException{
createSubTask = false;
assertTrue("Project should return subtasks provided by SubTaskContributor.", containsSubTaskImpl2);
assertTrue("Project should return subtasks provided by JobProperty.", containsSubTaskImpl);
-
+
}
-
+
@Test
public void testCreateExecutable() throws IOException{
FreeStyleProject p = j.createFreeStyleProject("project");
@@ -441,9 +441,9 @@ public void testCreateExecutable() throws IOException{
build = p.createExecutable();
assertNull("Disabled project should not create executable.", build);
assertEquals("Next build number should not be increased.", 2, p.nextBuildNumber);
-
+
}
-
+
@Test
public void testCheckout() throws Exception{
SCM scm = new NullSCM();
@@ -484,7 +484,7 @@ public void testPoll() throws Exception{
j.buildAndAssertSuccess(p);
assertEquals("Project should have polling result significant", PollingResult.Change.SIGNIFICANT, p.poll(TaskListener.NULL).change);
}
-
+
@Test
public void testHasParticipant() throws Exception{
User user = User.get("John Smith", true, Collections.emptyMap());
@@ -495,11 +495,11 @@ public void testHasParticipant() throws Exception{
j.buildAndAssertSuccess(project2);
assertFalse("Project should not have any participant.", project2.hasParticipant(user));
scm.addChange().withAuthor(user.getId());
- project.setScm(scm);
+ project.setScm(scm);
j.buildAndAssertSuccess(project);
assertTrue("Project should have participant.", project.hasParticipant(user));
}
-
+
@Test
public void testGetRelationship() throws Exception{
final FreeStyleProject upstream = j.createFreeStyleProject("upstream");
@@ -539,25 +539,25 @@ public void testGetRelationship() throws Exception{
assertEquals("downstream #4 should depend only on upstream #5", 4, relationship.get(5).min());
assertEquals("downstream #4 should depend only on upstream #5", 4, relationship.get(5).max()-1);
}
-
+
@Test
public void testDoCancelQueue() throws Exception{
FreeStyleProject project = j.createFreeStyleProject("project");
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
- j.jenkins.setSecurityRealm(realm);
+ j.jenkins.setSecurityRealm(realm);
User user = realm.createAccount("John Smith", "password");
try (ACLContext as = ACL.as(user)) {
assertThrows("User should not have permission to build project", AccessDeniedException3.class, () -> project.doCancelQueue(null, null));
}
}
-
+
@Test
public void testDoDoDelete() throws Exception{
FreeStyleProject project = j.createFreeStyleProject("project");
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setCrumbIssuer(null);
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
@@ -583,15 +583,15 @@ public void testDoDoDelete() throws Exception{
assertNull("Project should be deleted form memory.", j.jenkins.getItem(project.getDisplayName()));
assertFalse("Project should be deleted form disk.", project.getRootDir().exists());
}
-
+
@Test
public void testDoDoWipeOutWorkspace() throws Exception{
FreeStyleProject project = j.createFreeStyleProject("project");
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
- j.jenkins.setSecurityRealm(realm);
+ j.jenkins.setSecurityRealm(realm);
User user = realm.createAccount("John Smith", "password");
try (ACLContext as = ACL.as(user)) {
assertThrows("User should not have permission to build project", AccessDeniedException3.class, project::doDoWipeOutWorkspace);
@@ -615,15 +615,15 @@ public void testDoDoWipeOutWorkspace() throws Exception{
Thread.sleep(500);
assertFalse("Workspace should not exist.", project.getSomeWorkspace().exists());
}
-
+
@Test
public void testDoDisable() throws Exception{
FreeStyleProject project = j.createFreeStyleProject("project");
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
- j.jenkins.setSecurityRealm(realm);
+ j.jenkins.setSecurityRealm(realm);
User user = realm.createAccount("John Smith", "password");
try (ACLContext as = ACL.as(user)) {
assertThrows("User should not have permission to build project", AccessDeniedException3.class, project::doDisable);
@@ -644,11 +644,11 @@ public void testDoDisable() throws Exception{
}
assertTrue("Project should be disabled.", project.isDisabled());
}
-
+
@Test
public void testDoEnable() throws Exception{
FreeStyleProject project = j.createFreeStyleProject("project");
- GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
+ GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setCrumbIssuer(null);
HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(false);
@@ -676,36 +676,36 @@ public void testDoEnable() throws Exception{
}
assertFalse("Project should be enabled.", project.isDisabled());
}
-
+
/**
* Job is un-restricted (no nabel), this is submitted to queue, which spawns an on demand slave
*/
@Test
public void testJobSubmittedShouldSpawnCloud() throws Exception {
/*
- * Setup a project with an SCM. Jenkins should have no executors in itself.
+ * Setup a project with an SCM. Jenkins should have no executors in itself.
*/
- FreeStyleProject proj = j.createFreeStyleProject("JENKINS-21394-spawn");
+ FreeStyleProject proj = j.createFreeStyleProject("JENKINS-21394-spawn");
RequiresWorkspaceSCM requiresWorkspaceScm = new RequiresWorkspaceSCM(true);
- proj.setScm(requiresWorkspaceScm);
- j.jenkins.setNumExecutors(0);
+ proj.setScm(requiresWorkspaceScm);
+ j.jenkins.setNumExecutors(0);
/*
* We have a cloud
*/
DummyCloudImpl2 c2 = new DummyCloudImpl2(j, 0);
- c2.label = new LabelAtom("test-cloud-label");
+ c2.label = new LabelAtom("test-cloud-label");
j.jenkins.clouds.add(c2);
-
+
SCMTrigger t = new SCMTrigger("@daily", true);
t.start(proj, true);
proj.addTrigger(t);
t.new Runner().run();
-
+
Thread.sleep(1000);
//Assert that the job IS submitted to Queue.
- assertEquals(1, j.jenkins.getQueue().getItems().length);
+ assertEquals(1, j.jenkins.getQueue().getItems().length);
}
-
+
/**
* Job is restricted, but label can not be provided by any cloud, only normal agents. Then job will not submit, because no slave is available.
*/
@@ -714,68 +714,68 @@ public void testUnrestrictedJobNoLabelByCloudNoQueue() throws Exception {
assertTrue(j.jenkins.clouds.isEmpty());
//Create slave. (Online)
Slave s1 = j.createOnlineSlave();
-
+
//Create a project, and bind the job to the created slave
FreeStyleProject proj = j.createFreeStyleProject("JENKINS-21394-noqueue");
proj.setAssignedLabel(s1.getSelfLabel());
-
+
//Add an SCM to the project. We require a workspace for the poll
RequiresWorkspaceSCM requiresWorkspaceScm = new RequiresWorkspaceSCM(true);
proj.setScm(requiresWorkspaceScm);
-
- j.buildAndAssertSuccess(proj);
+
+ j.buildAndAssertSuccess(proj);
//Now create another slave. And restrict the job to that slave. The slave is offline, leaving the job with no assignable nodes.
- //We tell our mock SCM to return that it has got changes. But since there are no agents, we get the desired result.
+ //We tell our mock SCM to return that it has got changes. But since there are no agents, we get the desired result.
Slave s2 = j.createSlave();
proj.setAssignedLabel(s2.getSelfLabel());
requiresWorkspaceScm.hasChange = true;
-
+
//Poll (We now should have NO online agents, this should now return NO_CHANGES.
PollingResult pr = proj.poll(j.createTaskListener());
assertFalse(pr.hasChanges());
-
+
SCMTrigger t = new SCMTrigger("@daily", true);
t.start(proj, true);
proj.addTrigger(t);
-
+
t.new Runner().run();
-
+
/*
* Assert that the log contains the correct message.
*/
HtmlPage log = j.createWebClient().getPage(proj, "scmPollLog");
String logastext = log.asNormalizedText();
assertTrue(logastext.contains("(" + AbstractProject.WorkspaceOfflineReason.all_suitable_nodes_are_offline.name() + ")"));
-
+
}
-
+
/**
* Job is restricted. Label is on slave that can be started in cloud. Job is submitted to queue, which spawns an on demand slave.
*/
@Test
- public void testRestrictedLabelOnSlaveYesQueue() throws Exception {
+ public void testRestrictedLabelOnSlaveYesQueue() throws Exception {
FreeStyleProject proj = j.createFreeStyleProject("JENKINS-21394-yesqueue");
RequiresWorkspaceSCM requiresWorkspaceScm = new RequiresWorkspaceSCM(true);
- proj.setScm(requiresWorkspaceScm);
+ proj.setScm(requiresWorkspaceScm);
j.jenkins.setNumExecutors(0);
-
+
/*
* We have a cloud
*/
DummyCloudImpl2 c2 = new DummyCloudImpl2(j, 0);
- c2.label = new LabelAtom("test-cloud-label");
+ c2.label = new LabelAtom("test-cloud-label");
j.jenkins.clouds.add(c2);
proj.setAssignedLabel(c2.label);
-
+
SCMTrigger t = new SCMTrigger("@daily", true);
t.start(proj, true);
proj.addTrigger(t);
t.new Runner().run();
-
+
Thread.sleep(1000);
//The job should be in queue
- assertEquals(1, j.jenkins.getQueue().getItems().length);
+ assertEquals(1, j.jenkins.getQueue().getItems().length);
}
@Issue("JENKINS-22750")
@@ -783,11 +783,11 @@ public void testRestrictedLabelOnSlaveYesQueue() throws Exception {
public void testMasterJobPutInQueue() throws Exception {
FreeStyleProject proj = j.createFreeStyleProject("JENKINS-21394-yes-master-queue");
RequiresWorkspaceSCM requiresWorkspaceScm = new RequiresWorkspaceSCM(true);
- proj.setAssignedLabel(null);
- proj.setScm(requiresWorkspaceScm);
- j.jenkins.setNumExecutors(1);
+ proj.setAssignedLabel(null);
+ proj.setScm(requiresWorkspaceScm);
+ j.jenkins.setNumExecutors(1);
proj.setScm(requiresWorkspaceScm);
-
+
//First build is not important
j.buildAndAssertSuccess(proj);
@@ -801,9 +801,9 @@ public void testMasterJobPutInQueue() throws Exception {
}
public static class TransientAction extends InvisibleAction{
-
+
}
-
+
@TestExtension
public static class TransientActionFactoryImpl extends TransientProjectActionFactory{
@@ -814,25 +814,25 @@ public Collection extends Action> createFor(AbstractProject target) {
actions.add(new TransientAction());
return actions;
}
-
+
}
-
- @TestExtension
+
+ @TestExtension
public static class RequiresWorkspaceSCM extends NullSCM {
-
+
public boolean hasChange = false;
-
+
public RequiresWorkspaceSCM() { }
-
+
public RequiresWorkspaceSCM(boolean hasChange) {
this.hasChange = hasChange;
}
-
+
@Override
public boolean pollChanges(AbstractProject, ?> project, Launcher launcher, FilePath workspace, TaskListener listener) {
return hasChange;
}
-
+
@Override
public boolean requiresWorkspaceForPolling(){
return true;
@@ -840,7 +840,7 @@ public boolean requiresWorkspaceForPolling(){
@Override public SCMDescriptor> getDescriptor() {
return new SCMDescriptor(null) {};
}
-
+
@Override
protected PollingResult compareRemoteRevisionWith(AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) {
if(!hasChange) {
@@ -849,7 +849,7 @@ protected PollingResult compareRemoteRevisionWith(AbstractProject project, Launc
return PollingResult.SIGNIFICANT;
}
}
-
+
@TestExtension
public static class AlwaysChangedSCM extends NullSCM {
@@ -857,7 +857,7 @@ public static class AlwaysChangedSCM extends NullSCM {
public boolean pollChanges(AbstractProject, ?> project, Launcher launcher, FilePath workspace, TaskListener listener) {
return true;
}
-
+
@Override
public boolean requiresWorkspaceForPolling(){
return false;
@@ -867,9 +867,9 @@ public boolean requiresWorkspaceForPolling(){
protected PollingResult compareRemoteRevisionWith(AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) {
return PollingResult.SIGNIFICANT;
}
-
+
}
-
+
@TestExtension
public static class WorkspaceBrowserImpl extends WorkspaceBrowser{
@@ -879,18 +879,18 @@ public FilePath getWorkspace(Job job) {
return new FilePath(new File("some_file_path"));
return null;
}
-
+
}
-
+
public static class SCMCheckoutStrategyImpl extends DefaultSCMCheckoutStrategyImpl implements Serializable{
-
+
public SCMCheckoutStrategyImpl(){
-
+
}
}
-
+
public static class JobPropertyImp extends JobProperty{
@Override
@@ -899,10 +899,10 @@ public Collection getSubTasks() {
list.add(new SubTaskImpl());
return list;
}
-
-
+
+
}
-
+
@TestExtension
public static class SubTaskContributorImpl extends SubTaskContributor{
@@ -915,13 +915,13 @@ public Collection extends SubTask> forProject(AbstractProject, ?> p) {
return list;
}
}
-
+
public static class SubTaskImpl2 extends SubTaskImpl{
-
+
}
-
+
public static class SubTaskImpl implements SubTask{
-
+
public String projectName;
@Override
@@ -939,13 +939,13 @@ public String getDisplayName() {
return "some task";
}
-
+
}
-
+
public class ActionImpl extends InvisibleAction{
-
+
}
-
+
@TestExtension
public static class DummyCloudImpl2 extends Cloud {
private final transient JenkinsRule caller;
@@ -966,8 +966,8 @@ public static class DummyCloudImpl2 extends Cloud {
* Only reacts to provisioning for this label.
*/
public Label label;
-
- public DummyCloudImpl2() {
+
+ public DummyCloudImpl2() {
super("test");
this.delay = 0;
this.caller = null;
@@ -996,7 +996,7 @@ public Collection provision(Label label, int excess
@Override
public boolean canProvision(Label label) {
- //This cloud can ALWAYS provision
+ //This cloud can ALWAYS provision
return true;
/* return label==this.label; */
}
diff --git a/test/src/test/java/hudson/model/QueueTest.java b/test/src/test/java/hudson/model/QueueTest.java
index 5e8d9eb2057b..24c75e5f760b 100644
--- a/test/src/test/java/hudson/model/QueueTest.java
+++ b/test/src/test/java/hudson/model/QueueTest.java
@@ -533,7 +533,7 @@ public boolean perform(AbstractBuild, ?> build, Launcher launcher, BuildListen
String tagName = queueItem.getDocumentElement().getTagName();
assertTrue(tagName.equals("blockedItem") || tagName.equals("buildableItem"));
}
-
+
@Issue("JENKINS-28926")
@Test
public void upstreamDownstreamCycle() throws Exception {
@@ -833,32 +833,32 @@ public void run() {
@Test public void testBlockBuildWhenUpstreamBuildingLock() throws Exception {
final String prefix = "JENKINS-27871";
r.getInstance().setNumExecutors(4);
-
+
final FreeStyleProject projectA = r.createFreeStyleProject(prefix+"A");
projectA.getBuildersList().add(new SleepBuilder(5000));
-
+
final FreeStyleProject projectB = r.createFreeStyleProject(prefix+"B");
- projectB.getBuildersList().add(new SleepBuilder(10000));
+ projectB.getBuildersList().add(new SleepBuilder(10000));
projectB.setBlockBuildWhenUpstreamBuilding(true);
final FreeStyleProject projectC = r.createFreeStyleProject(prefix+"C");
projectC.getBuildersList().add(new SleepBuilder(10000));
projectC.setBlockBuildWhenUpstreamBuilding(true);
-
+
projectA.getPublishersList().add(new BuildTrigger(Collections.singletonList(projectB), Result.SUCCESS));
projectB.getPublishersList().add(new BuildTrigger(Collections.singletonList(projectC), Result.SUCCESS));
-
+
final QueueTaskFuture taskA = projectA.scheduleBuild2(0, new TimerTriggerCause());
Thread.sleep(1000);
final QueueTaskFuture taskB = projectB.scheduleBuild2(0, new TimerTriggerCause());
final QueueTaskFuture taskC = projectC.scheduleBuild2(0, new TimerTriggerCause());
-
- final FreeStyleBuild buildA = taskA.get(60, TimeUnit.SECONDS);
- final FreeStyleBuild buildB = taskB.get(60, TimeUnit.SECONDS);
+
+ final FreeStyleBuild buildA = taskA.get(60, TimeUnit.SECONDS);
+ final FreeStyleBuild buildB = taskB.get(60, TimeUnit.SECONDS);
final FreeStyleBuild buildC = taskC.get(60, TimeUnit.SECONDS);
long buildBEndTime = buildB.getStartTimeInMillis() + buildB.getDuration();
assertTrue("Project B build should be finished before the build of project C starts. " +
- "B finished at " + buildBEndTime + ", C started at " + buildC.getStartTimeInMillis(),
+ "B finished at " + buildBEndTime + ", C started at " + buildC.getStartTimeInMillis(),
buildC.getStartTimeInMillis() >= buildBEndTime);
}
diff --git a/test/src/test/java/hudson/model/RunParameterDefinitionTest.java b/test/src/test/java/hudson/model/RunParameterDefinitionTest.java
index 869f98c054e7..f31f8cd66c57 100644
--- a/test/src/test/java/hudson/model/RunParameterDefinitionTest.java
+++ b/test/src/test/java/hudson/model/RunParameterDefinitionTest.java
@@ -101,13 +101,13 @@ public void testNULLFilter() throws Exception {
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.NOT_BUILT)));
FreeStyleBuild notBuiltBuild = j.buildAndAssertStatus(Result.NOT_BUILT, project);
-
+
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.ABORTED)));
FreeStyleBuild abortedBuild = j.buildAndAssertStatus(Result.ABORTED, project);
FreeStyleProject paramProject = j.createFreeStyleProject("paramProject");
- ParametersDefinitionProperty pdp =
- new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
+ ParametersDefinitionProperty pdp =
+ new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
project.getName(),
"run description",
null));
@@ -118,7 +118,7 @@ public void testNULLFilter() throws Exception {
build.getEnvironment(new LogTaskListener(LOGGER, Level.INFO)).get("RUN_NUMBER"));
}
-
+
@Test
public void testALLFilter() throws Exception {
@@ -133,13 +133,13 @@ public void testALLFilter() throws Exception {
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.NOT_BUILT)));
FreeStyleBuild notBuiltBuild = j.buildAndAssertStatus(Result.NOT_BUILT, project);
-
+
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.ABORTED)));
FreeStyleBuild abortedBuild = j.buildAndAssertStatus(Result.ABORTED, project);
FreeStyleProject paramProject = j.createFreeStyleProject("paramProject");
- ParametersDefinitionProperty pdp =
- new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
+ ParametersDefinitionProperty pdp =
+ new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
project.getName(),
"run description",
RunParameterFilter.ALL));
@@ -164,13 +164,13 @@ public void testCOMPLETEDFilter() throws Exception {
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.NOT_BUILT)));
FreeStyleBuild notBuiltBuild = j.buildAndAssertStatus(Result.NOT_BUILT, project);
-
+
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.ABORTED)));
FreeStyleBuild abortedBuild = j.buildAndAssertStatus(Result.ABORTED, project);
FreeStyleProject paramProject = j.createFreeStyleProject("paramProject");
- ParametersDefinitionProperty pdp =
- new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
+ ParametersDefinitionProperty pdp =
+ new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
project.getName(),
"run description",
RunParameterFilter.COMPLETED));
@@ -180,7 +180,7 @@ public void testCOMPLETEDFilter() throws Exception {
assertEquals(Integer.toString(abortedBuild.getNumber()),
build.getEnvironment(new LogTaskListener(LOGGER, Level.INFO)).get("RUN_NUMBER"));
}
-
+
@Test
public void testSUCCESSFULFilter() throws Exception {
@@ -195,13 +195,13 @@ public void testSUCCESSFULFilter() throws Exception {
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.NOT_BUILT)));
FreeStyleBuild notBuiltBuild = j.buildAndAssertStatus(Result.NOT_BUILT, project);
-
+
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.ABORTED)));
FreeStyleBuild abortedBuild = j.buildAndAssertStatus(Result.ABORTED, project);
FreeStyleProject paramProject = j.createFreeStyleProject("paramProject");
- ParametersDefinitionProperty pdp =
- new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
+ ParametersDefinitionProperty pdp =
+ new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
project.getName(),
"run description",
RunParameterFilter.SUCCESSFUL));
@@ -211,8 +211,8 @@ public void testSUCCESSFULFilter() throws Exception {
assertEquals(Integer.toString(unstableBuild.getNumber()),
build.getEnvironment(new LogTaskListener(LOGGER, Level.INFO)).get("RUN_NUMBER"));
}
-
-
+
+
@Test
public void testSTABLEFilter() throws Exception {
@@ -227,13 +227,13 @@ public void testSTABLEFilter() throws Exception {
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.NOT_BUILT)));
FreeStyleBuild notBuiltBuild = j.buildAndAssertStatus(Result.NOT_BUILT, project);
-
+
project.getPublishersList().replaceBy(Collections.singleton(new ResultPublisher(Result.ABORTED)));
FreeStyleBuild abortedBuild = j.buildAndAssertStatus(Result.ABORTED, project);
FreeStyleProject paramProject = j.createFreeStyleProject("paramProject");
- ParametersDefinitionProperty pdp =
- new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
+ ParametersDefinitionProperty pdp =
+ new ParametersDefinitionProperty(new RunParameterDefinition("RUN",
project.getName(),
"run description",
RunParameterFilter.STABLE));
@@ -243,8 +243,8 @@ public void testSTABLEFilter() throws Exception {
assertEquals(Integer.toString(successfulBuild.getNumber()),
build.getEnvironment(new LogTaskListener(LOGGER, Level.INFO)).get("RUN_NUMBER"));
}
-
-
+
+
@Test
public void testLoadEnvironmentVariablesWhenRunParameterJobHasBeenDeleted() throws Exception {
diff --git a/test/src/test/java/hudson/model/RunTest.java b/test/src/test/java/hudson/model/RunTest.java
index 73e7c35c2d83..963dc80490bb 100644
--- a/test/src/test/java/hudson/model/RunTest.java
+++ b/test/src/test/java/hudson/model/RunTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jorg Heymans
- *
+ *
* 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
@@ -217,7 +217,7 @@ public FullNameChangingProject newInstance(ItemGroup parent, String name) {
}
}
}
-
+
public static final class Mgr extends ArtifactManager {
static final AtomicBoolean deleted = new AtomicBoolean();
@Override public boolean delete() {
diff --git a/test/src/test/java/hudson/model/SimpleJobTest.java b/test/src/test/java/hudson/model/SimpleJobTest.java
index e623b6111047..6b6f17ea77ec 100644
--- a/test/src/test/java/hudson/model/SimpleJobTest.java
+++ b/test/src/test/java/hudson/model/SimpleJobTest.java
@@ -18,20 +18,20 @@ public class SimpleJobTest {
@Rule
public JenkinsRule rule = new JenkinsRule();
-
+
@Test
public void testGetEstimatedDuration() throws IOException {
-
+
final SortedMap runs = new TreeMap<>();
-
+
Job project = createMockProject(runs);
-
+
TestBuild previousPreviousBuild = new TestBuild(project, Result.SUCCESS, 20, null);
runs.put(3, previousPreviousBuild);
-
+
TestBuild previousBuild = new TestBuild(project, Result.SUCCESS, 15, previousPreviousBuild);
runs.put(2, previousBuild);
-
+
TestBuild lastBuild = new TestBuild(project, Result.SUCCESS, 42, previousBuild);
runs.put(1, lastBuild);
@@ -40,79 +40,79 @@ public void testGetEstimatedDuration() throws IOException {
assertTrue("Expected < 42, but was "+project.getEstimatedDuration(), project.getEstimatedDuration() < 42);
assertTrue("Expected > 15, but was "+project.getEstimatedDuration(), project.getEstimatedDuration() > 15);
}
-
+
@Test
public void testGetEstimatedDurationWithOneRun() throws IOException {
-
+
final SortedMap runs = new TreeMap<>();
-
+
Job project = createMockProject(runs);
-
+
TestBuild lastBuild = new TestBuild(project, Result.SUCCESS, 42, null);
runs.put(1, lastBuild);
assertEquals(42, project.getEstimatedDuration());
}
-
+
@Test
public void testGetEstimatedDurationWithFailedRun() throws IOException {
-
+
final SortedMap runs = new TreeMap<>();
-
+
Job project = createMockProject(runs);
-
+
TestBuild lastBuild = new TestBuild(project, Result.FAILURE, 42, null);
runs.put(1, lastBuild);
assertEquals(42, project.getEstimatedDuration());
}
-
+
@Test
public void testGetEstimatedDurationWithNoRuns() {
-
+
final SortedMap runs = new TreeMap<>();
-
+
Job project = createMockProject(runs);
-
+
assertEquals(-1, project.getEstimatedDuration());
}
-
+
@Test
public void testGetEstimatedDurationIfPrevious3BuildsFailed() throws IOException {
-
+
final SortedMap runs = new TreeMap<>();
-
+
Job project = createMockProject(runs);
-
+
TestBuild prev5Build = new TestBuild(project, Result.UNSTABLE, 1, null);
runs.put(6, prev5Build);
-
+
TestBuild prev4Build = new TestBuild(project, Result.SUCCESS, 1, prev5Build);
runs.put(5, prev4Build);
-
+
TestBuild prev3Build = new TestBuild(project, Result.SUCCESS, 1, prev4Build);
runs.put(4, prev3Build);
-
+
TestBuild previous2Build = new TestBuild(project, Result.FAILURE, 50, prev3Build);
runs.put(3, previous2Build);
-
+
TestBuild previousBuild = new TestBuild(project, Result.FAILURE, 50, previous2Build);
runs.put(2, previousBuild);
-
+
TestBuild lastBuild = new TestBuild(project, Result.FAILURE, 50, previousBuild);
runs.put(1, lastBuild);
// failed builds must not be used, if there are successfulBuilds available.
assertEquals(1, project.getEstimatedDuration());
}
-
+
@Test
public void testGetEstimatedDurationIfNoSuccessfulBuildTakeDurationOfFailedBuild() throws IOException {
-
+
final SortedMap runs = new TreeMap<>();
-
+
Job project = createMockProject(runs);
-
+
TestBuild lastBuild = new TestBuild(project, Result.FAILURE, 50, null);
runs.put(1, lastBuild);
@@ -125,29 +125,29 @@ private Job createMockProject(final SortedMap runs) {
@SuppressWarnings("unchecked")
private static class TestBuild extends Run {
-
+
TestBuild(Job project, Result result, long duration, TestBuild previousBuild) throws IOException {
super(project);
this.result = result;
this.duration = duration;
this.previousBuild = previousBuild;
}
-
+
@Override
public int compareTo(Run o) {
return 0;
}
-
+
@Override
public Result getResult() {
return result;
}
-
+
@Override
public boolean isBuilding() {
return false;
}
-
+
}
private class TestJob extends Job implements TopLevelItem {
diff --git a/test/src/test/java/hudson/model/UpdateCenterCustomTest.java b/test/src/test/java/hudson/model/UpdateCenterCustomTest.java
index 69d95d7f9469..a7af94a1fed8 100644
--- a/test/src/test/java/hudson/model/UpdateCenterCustomTest.java
+++ b/test/src/test/java/hudson/model/UpdateCenterCustomTest.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2016 CloudBees, Inc.
- *
+ *
* 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
@@ -36,10 +36,10 @@
* Tests of the custom {@link UpdateCenter} implementation.
*/
public class UpdateCenterCustomTest {
-
+
@Rule
public final JenkinsRule j = new CustomUpdateCenterRule(CustomUpdateCenter.class);
-
+
@Test
public void shouldStartupWithCustomUpdateCenter() {
UpdateCenter uc = j.jenkins.getUpdateCenter();
@@ -50,7 +50,7 @@ public void shouldStartupWithCustomUpdateCenter() {
private static final class CustomUpdateCenterRule extends JenkinsRule {
private final String updateCenterClassName;
private String _oldValue = null;
-
+
private static final String PROPERTY_NAME = UpdateCenter.class.getName()+".className";
CustomUpdateCenterRule(Class> ucClass) {
@@ -75,15 +75,15 @@ public String getUpdateCenterClassName() {
return updateCenterClassName;
}
}
-
+
public static final class CustomUpdateCenter extends UpdateCenter {
public CustomUpdateCenter() {
}
-
+
public CustomUpdateCenter(UpdateCenterConfiguration config) {
super(config);
}
-
+
}
}
diff --git a/test/src/test/java/hudson/model/UpdateCenterTest.java b/test/src/test/java/hudson/model/UpdateCenterTest.java
index 630522f62d5a..142a5da6c1d7 100644
--- a/test/src/test/java/hudson/model/UpdateCenterTest.java
+++ b/test/src/test/java/hudson/model/UpdateCenterTest.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -42,7 +42,7 @@
/**
* Quick test for {@link UpdateCenter}.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class UpdateCenterTest {
diff --git a/test/src/test/java/hudson/model/UpdateSiteTest.java b/test/src/test/java/hudson/model/UpdateSiteTest.java
index 2928162f0e57..07d812102b3a 100644
--- a/test/src/test/java/hudson/model/UpdateSiteTest.java
+++ b/test/src/test/java/hudson/model/UpdateSiteTest.java
@@ -111,7 +111,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
public void shutdownWebserver() throws Exception {
server.stop();
}
-
+
@Test public void relativeURLs() throws Exception {
URL url = new URL(baseUrl, "/plugins/htmlpublisher-update-center.json");
UpdateSite site = new UpdateSite(UpdateCenter.ID_DEFAULT, url.toString());
@@ -139,7 +139,7 @@ public void shutdownWebserver() throws Exception {
UpdateSite site = getUpdateSite("/plugins/htmlpublisher-update-center.json");
UpdateSite alternativeSite = getUpdateSite("/plugins/alternative-update-center.json", "alternative");
overrideUpdateSite(site, alternativeSite);
- // sites use different Wiki URL for dummy -> use URL from manifest
+ // sites use different Wiki URL for dummy -> use URL from manifest
PluginWrapper wrapper = buildPluginWrapper("dummy", "https://wiki.jenkins.io/display/JENKINS/dummy");
assertEquals("https://wiki.jenkins.io/display/JENKINS/dummy", wrapper.getUrl());
// sites use the same Wiki URL for HTML Publisher -> use it
diff --git a/test/src/test/java/hudson/model/UserTest.java b/test/src/test/java/hudson/model/UserTest.java
index 390165df9e6b..e437ee05eff0 100644
--- a/test/src/test/java/hudson/model/UserTest.java
+++ b/test/src/test/java/hudson/model/UserTest.java
@@ -510,7 +510,7 @@ public void testCanDelete() throws IOException {
// @Issue("SECURITY-180")
public void security180() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
final GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy();
j.jenkins.setAuthorizationStrategy(auth);
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
diff --git a/test/src/test/java/hudson/model/ViewTest.java b/test/src/test/java/hudson/model/ViewTest.java
index 82bc39c922a3..e2fee78121c1 100644
--- a/test/src/test/java/hudson/model/ViewTest.java
+++ b/test/src/test/java/hudson/model/ViewTest.java
@@ -982,7 +982,7 @@ public TopLevelItem newInstance(ItemGroup parent, String name) {
}
}
-
+
//Duplication with ViewTest.CompositeView from core unit test module - unfortunately it is inaccessible from here
private static class DummyCompositeView extends View implements ViewGroup {
diff --git a/test/src/test/java/hudson/model/queue/BuildKeepsRunningWhenFaultySubTasksTest.java b/test/src/test/java/hudson/model/queue/BuildKeepsRunningWhenFaultySubTasksTest.java
index 7c81f20bf976..b4140a41fa0d 100644
--- a/test/src/test/java/hudson/model/queue/BuildKeepsRunningWhenFaultySubTasksTest.java
+++ b/test/src/test/java/hudson/model/queue/BuildKeepsRunningWhenFaultySubTasksTest.java
@@ -24,7 +24,7 @@ public class BuildKeepsRunningWhenFaultySubTasksTest {
public JenkinsRule j = new JenkinsRule();
public static final String ERROR_MESSAGE = "My unexpected exception";
-
+
// When using SubTaskContributor (FailingSubTaskContributor) the build never ends
@Test
@Issue("JENKINS-59793")
@@ -36,7 +36,7 @@ public void buildFinishesWhenSubTaskFails() throws Exception {
// We don't get stalled waiting the finalization of the job
future.get(5, TimeUnit.SECONDS);
}
-
+
// A SubTask failing with an exception
@TestExtension
public static class FailingSubTaskContributor extends SubTaskContributor {
diff --git a/test/src/test/java/hudson/node_monitors/ClockMonitorDescriptorTest.java b/test/src/test/java/hudson/node_monitors/ClockMonitorDescriptorTest.java
index e84cbc3f048b..463b0c5d7188 100644
--- a/test/src/test/java/hudson/node_monitors/ClockMonitorDescriptorTest.java
+++ b/test/src/test/java/hudson/node_monitors/ClockMonitorDescriptorTest.java
@@ -16,10 +16,10 @@
* @author Richard Mortimer
*/
public class ClockMonitorDescriptorTest {
-
+
@Rule
public JenkinsRule jenkins = new JenkinsRule();
-
+
/**
* Makes sure that it returns sensible values.
*/
diff --git a/test/src/test/java/hudson/pages/SystemConfigurationTestCase.java b/test/src/test/java/hudson/pages/SystemConfigurationTestCase.java
index 1bc4d88558f2..8f8cee86a602 100644
--- a/test/src/test/java/hudson/pages/SystemConfigurationTestCase.java
+++ b/test/src/test/java/hudson/pages/SystemConfigurationTestCase.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Erik Ramfelt
- *
+ *
* 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
diff --git a/test/src/test/java/hudson/scm/AbstractScmTagActionTest.java b/test/src/test/java/hudson/scm/AbstractScmTagActionTest.java
index df6a146f48c6..cc53fe3aada1 100644
--- a/test/src/test/java/hudson/scm/AbstractScmTagActionTest.java
+++ b/test/src/test/java/hudson/scm/AbstractScmTagActionTest.java
@@ -55,7 +55,7 @@ public class AbstractScmTagActionTest {
@Test
public void regularTextDisplayedCorrectly() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
-
+
String tagToKeep = "Nice tag with space";
p.setScm(new FakeSCM(tagToKeep));
@@ -64,7 +64,7 @@ public void regularTextDisplayedCorrectly() throws Exception {
String tooltip = buildAndExtractTooltipAttribute(p);
assertEquals(tagToKeep, tooltip);
}
-
+
@Test
@Issue("SECURITY-1537")
public void preventXssInTagAction() throws Exception {
@@ -77,7 +77,7 @@ public void preventXssInTagAction() throws Exception {
assertThat(tooltip, not(containsString("<")));
assertThat(tooltip, startsWith("<"));
}
-
+
private String buildAndExtractTooltipAttribute(FreeStyleProject p) throws Exception {
JenkinsRule.WebClient wc = j.createWebClient();
diff --git a/test/src/test/java/hudson/scm/ScmTest.java b/test/src/test/java/hudson/scm/ScmTest.java
index bd683c8d5541..a69709dee40a 100644
--- a/test/src/test/java/hudson/scm/ScmTest.java
+++ b/test/src/test/java/hudson/scm/ScmTest.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/test/src/test/java/hudson/search/SearchTest.java b/test/src/test/java/hudson/search/SearchTest.java
index 5250cd489313..ac1fd2390047 100644
--- a/test/src/test/java/hudson/search/SearchTest.java
+++ b/test/src/test/java/hudson/search/SearchTest.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -59,9 +59,9 @@
* @author Kohsuke Kawaguchi
*/
public class SearchTest {
-
+
@Rule public JenkinsRule j = new JenkinsRule();
-
+
/**
* No exact match should result in a failure status code.
*/
@@ -87,17 +87,17 @@ public void testXSS() throws Exception {
HtmlPage resultPage = wc.search("");
assertEquals(HttpURLConnection.HTTP_NOT_FOUND, resultPage.getWebResponse().getStatusCode());
}
-
+
@Test
public void testSearchByProjectName() throws Exception {
final String projectName = "testSearchByProjectName";
-
+
j.createFreeStyleProject(projectName);
-
+
Page result = j.search(projectName);
assertNotNull(result);
j.assertGoodStatus(result);
-
+
// make sure we've fetched the testSearchByDisplayName project page
String contents = result.getWebResponse().getContentAsString();
assertTrue(contents.contains(String.format("%s [Jenkins]", projectName)));
@@ -137,19 +137,19 @@ public void testSearchByProjectNameInAFolder() throws Exception {
@Test
public void testSearchByDisplayName() throws Exception {
final String displayName = "displayName9999999";
-
+
FreeStyleProject project = j.createFreeStyleProject("testSearchByDisplayName");
project.setDisplayName(displayName);
-
+
Page result = j.search(displayName);
assertNotNull(result);
j.assertGoodStatus(result);
-
+
// make sure we've fetched the testSearchByDisplayName project page
String contents = result.getWebResponse().getContentAsString();
assertTrue(contents.contains(String.format("%s [Jenkins]", displayName)));
}
-
+
@Test
public void testSearch2ProjectsWithSameDisplayName() throws Exception {
// create 2 freestyle projects with the same display name
@@ -158,7 +158,7 @@ public void testSearch2ProjectsWithSameDisplayName() throws Exception {
final String projectName3 = "projectName3";
final String displayName = "displayNameFoo";
final String otherDisplayName = "otherDisplayName";
-
+
FreeStyleProject project1 = j.createFreeStyleProject(projectName1);
project1.setDisplayName(displayName);
FreeStyleProject project2 = j.createFreeStyleProject(projectName2);
@@ -178,7 +178,7 @@ public void testSearch2ProjectsWithSameDisplayName() throws Exception {
assertTrue(contents.contains(String.format("%s [Jenkins]", displayName)));
assertFalse(contents.contains(otherDisplayName));
}
-
+
@Test
public void testProjectNamePrecedesDisplayName() throws Exception {
final String project1Name = "foo";
@@ -187,11 +187,11 @@ public void testProjectNamePrecedesDisplayName() throws Exception {
final String project2DisplayName = project1Name;
final String project3Name = "project3Name";
final String project3DisplayName = "project3DisplayName";
-
+
// create 1 freestyle project with the name foo
FreeStyleProject project1 = j.createFreeStyleProject(project1Name);
project1.setDisplayName(project1DisplayName);
-
+
// create another with the display name foo
FreeStyleProject project2 = j.createFreeStyleProject(project2Name);
project2.setDisplayName(project2DisplayName);
@@ -199,12 +199,12 @@ public void testProjectNamePrecedesDisplayName() throws Exception {
// create a third project and make sure it's not picked up by search
FreeStyleProject project3 = j.createFreeStyleProject(project3Name);
project3.setDisplayName(project3DisplayName);
-
+
// search for foo
Page result = j.search(project1Name);
assertNotNull(result);
j.assertGoodStatus(result);
-
+
// make sure we get the project with the name foo
String contents = result.getWebResponse().getContentAsString();
assertTrue(contents.contains(String.format("%s [Jenkins]", project1DisplayName)));
@@ -213,7 +213,7 @@ public void testProjectNamePrecedesDisplayName() throws Exception {
assertFalse(contents.contains(project3Name));
assertFalse(contents.contains(project3DisplayName));
}
-
+
@Test
public void testGetSuggestionsHasBothNamesAndDisplayNames() throws Exception {
final String projectName = "project name";
@@ -221,26 +221,26 @@ public void testGetSuggestionsHasBothNamesAndDisplayNames() throws Exception {
FreeStyleProject project1 = j.createFreeStyleProject(projectName);
project1.setDisplayName(displayName);
-
+
WebClient wc = j.createWebClient();
Page result = wc.goTo("search/suggest?query=name", "application/json");
assertNotNull(result);
j.assertGoodStatus(result);
-
+
String content = result.getWebResponse().getContentAsString();
System.out.println(content);
JSONObject jsonContent = (JSONObject)JSONSerializer.toJSON(content);
assertNotNull(jsonContent);
JSONArray jsonArray = jsonContent.getJSONArray("suggestions");
assertNotNull(jsonArray);
-
+
assertEquals(2, jsonArray.size());
-
+
boolean foundProjectName = false;
boolean foundDisplayName = false;
for(Object suggestion : jsonArray) {
JSONObject jsonSuggestion = (JSONObject)suggestion;
-
+
String name = (String)jsonSuggestion.get("name");
if(projectName.equals(name)) {
foundProjectName = true;
@@ -405,7 +405,7 @@ public void run() {
}
});
}
-
+
@Test
public void testSearchWithinFolders() throws Exception {
MockFolder folder1 = j.createFolder("folder1");
diff --git a/test/src/test/java/hudson/security/ExtendedReadPermissionTest.java b/test/src/test/java/hudson/security/ExtendedReadPermissionTest.java
index 5a3b154a7f39..515c704f1cb4 100644
--- a/test/src/test/java/hudson/security/ExtendedReadPermissionTest.java
+++ b/test/src/test/java/hudson/security/ExtendedReadPermissionTest.java
@@ -68,7 +68,7 @@ private void setPermissionEnabled(boolean enabled) {
+ " MockAuthorizationStrategy does not implement this check.")
@Test public void readOnlyConfigAccessWithPermissionDisabled() throws Exception {
setPermissionEnabled(false);
-
+
JenkinsRule.WebClient wc = r.createWebClient();
wc.withBasicCredentials("charlie");
diff --git a/test/src/test/java/hudson/security/HudsonPrivateSecurityRealmTest.java b/test/src/test/java/hudson/security/HudsonPrivateSecurityRealmTest.java
index 4ba76a0dedb8..80f6c4ec1f66 100644
--- a/test/src/test/java/hudson/security/HudsonPrivateSecurityRealmTest.java
+++ b/test/src/test/java/hudson/security/HudsonPrivateSecurityRealmTest.java
@@ -98,7 +98,7 @@ public void setup() throws Exception {
public void fullNameCollisionPassword() throws Exception {
HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(false, false, null);
j.jenkins.setSecurityRealm(securityRealm);
-
+
User u1 = securityRealm.createAccount("user1", "password1");
u1.setFullName("User One");
u1.save();
@@ -113,17 +113,17 @@ public void fullNameCollisionPassword() throws Exception {
WebClient wc2 = j.createWebClient();
wc2.login("user2", "password2");
-
+
// Check both users can use their token
XmlPage w1 = (XmlPage) wc1.goTo("whoAmI/api/xml", "application/xml");
assertThat(w1, hasXPath("//name", is("user1")));
-
+
XmlPage w2 = (XmlPage) wc2.goTo("whoAmI/api/xml", "application/xml");
assertThat(w2, hasXPath("//name", is("user2")));
u1.setFullName("user2");
u1.save();
-
+
// check the tokens still work
wc1 = j.createWebClient();
wc1.login("user1", "password1");
@@ -135,7 +135,7 @@ public void fullNameCollisionPassword() throws Exception {
// belt and braces in case the failed login no longer throws exceptions.
w1 = (XmlPage) wc1.goTo("whoAmI/api/xml", "application/xml");
assertThat(w1, hasXPath("//name", is("user1")));
-
+
w2 = (XmlPage) wc2.goTo("whoAmI/api/xml", "application/xml");
assertThat(w2, hasXPath("//name", is("user2")));
}
@@ -144,10 +144,10 @@ public void fullNameCollisionPassword() throws Exception {
@Test
public void fullNameCollisionToken() throws Exception {
ApiTokenTestHelper.enableLegacyBehavior();
-
+
HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(false, false, null);
j.jenkins.setSecurityRealm(securityRealm);
-
+
User u1 = securityRealm.createAccount("user1", "password1");
u1.setFullName("User One");
u1.save();
@@ -165,11 +165,11 @@ public void fullNameCollisionToken() throws Exception {
WebClient wc2 = j.createWebClient();
wc2.addRequestHeader("Authorization", basicHeader("user2", u2Token));
//wc2.setCredentialsProvider(new FixedCredentialsProvider("user2", u1Token));
-
+
// Check both users can use their token
XmlPage w1 = (XmlPage) wc1.goTo("whoAmI/api/xml", "application/xml");
assertThat(w1, hasXPath("//name", is("user1")));
-
+
XmlPage w2 = (XmlPage) wc2.goTo("whoAmI/api/xml", "application/xml");
assertThat(w2, hasXPath("//name", is("user2")));
@@ -179,7 +179,7 @@ public void fullNameCollisionToken() throws Exception {
// check the tokens still work
w1 = (XmlPage) wc1.goTo("whoAmI/api/xml", "application/xml");
assertThat(w1, hasXPath("//name", is("user1")));
-
+
w2 = (XmlPage) wc2.goTo("whoAmI/api/xml", "application/xml");
assertThat(w2, hasXPath("//name", is("user2")));
}
@@ -424,11 +424,11 @@ protected void loggedIn(@NonNull String username) {
public void controlCharacterAreNoMoreValid() throws Exception {
HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(true, false, null);
j.jenkins.setSecurityRealm(securityRealm);
-
+
String password = "testPwd";
String email = "test@test.com";
int i = 0;
-
+
// regular case = only accepting a-zA-Z0-9 + "-_"
checkUserCanBeCreatedWith(securityRealm, "test" + i, password, "Test" + i, email);
assertNotNull(User.getById("test" + i, false));
@@ -454,23 +454,23 @@ public void controlCharacterAreNoMoreValid() throws Exception {
checkUserCannotBeCreatedWith(securityRealm, "te\u0000st" + i, password, "Test" + i, email);
}
}
-
+
@Issue("SECURITY-786")
@Test
public void controlCharacterAreNoMoreValid_CustomRegex() throws Exception {
HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(true, false, null);
j.jenkins.setSecurityRealm(securityRealm);
-
+
String currentRegex = "^[A-Z]+[0-9]*$";
-
+
Field field = HudsonPrivateSecurityRealm.class.getDeclaredField("ID_REGEX");
field.setAccessible(true);
field.set(null, currentRegex);
-
+
String password = "testPwd";
String email = "test@test.com";
int i = 0;
-
+
// regular case = only accepting a-zA-Z0-9 + "-_"
checkUserCanBeCreatedWith(securityRealm, "TEST" + i, password, "Test" + i, email);
assertNotNull(User.getById("TEST" + i, false));
@@ -489,7 +489,7 @@ public void controlCharacterAreNoMoreValid_CustomRegex() throws Exception {
{ // we can even change regex on the fly
currentRegex = "^[0-9]*$";
field.set(null, currentRegex);
-
+
checkUserCanBeCreatedWith(securityRealm, "125213" + i, password, "Test" + i, email);
assertNotNull(User.getById("125213" + i, false));
i++;
@@ -557,7 +557,7 @@ public void ensureHashingVersion_2x_isNotSupported() {
public void ensureHashingVersion_2y_isNotSupported() {
assertThrows(IllegalArgumentException.class, () -> BCrypt.checkpw("a", "$2y$08$cfcvVd2aQ8CMvoMpP2EBfeodLEkkFJ9umNEfPD18.hUF62qqlC/V."));
}
-
+
private void checkUserCanBeCreatedWith(HudsonPrivateSecurityRealm securityRealm, String id, String password, String fullName, String email) throws Exception {
JenkinsRule.WebClient wc = j.createWebClient();
SignupPage signup = new SignupPage(wc.goTo("signup"));
@@ -568,7 +568,7 @@ private void checkUserCanBeCreatedWith(HudsonPrivateSecurityRealm securityRealm,
HtmlPage success = signup.submit(j);
assertThat(success.getElementById("main-panel").getTextContent(), containsString("Success"));
}
-
+
private void checkUserCannotBeCreatedWith(HudsonPrivateSecurityRealm securityRealm, String id, String password, String fullName, String email) throws Exception {
JenkinsRule.WebClient wc = j.createWebClient();
SignupPage signup = new SignupPage(wc.goTo("signup"));
@@ -580,7 +580,7 @@ private void checkUserCannotBeCreatedWith(HudsonPrivateSecurityRealm securityRea
assertThat(success.getElementById("main-panel").getTextContent(), not(containsString("Success")));
assertThat(success.getElementById("main-panel").getTextContent(), containsString(Messages.HudsonPrivateSecurityRealm_CreateAccount_UserNameInvalidCharacters()));
}
-
+
private void checkUserCannotBeCreatedWith_custom(HudsonPrivateSecurityRealm securityRealm, String id, String password, String fullName, String email, String regex) throws Exception {
JenkinsRule.WebClient wc = j.createWebClient();
SignupPage signup = new SignupPage(wc.goTo("signup"));
diff --git a/test/src/test/java/hudson/security/PermissionGroupTest.java b/test/src/test/java/hudson/security/PermissionGroupTest.java
index 70d87fa57827..f6fd5d693bac 100644
--- a/test/src/test/java/hudson/security/PermissionGroupTest.java
+++ b/test/src/test/java/hudson/security/PermissionGroupTest.java
@@ -1,18 +1,18 @@
/*
* 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
diff --git a/test/src/test/java/hudson/security/WhoAmITest.java b/test/src/test/java/hudson/security/WhoAmITest.java
index dae0f6940ac4..39c8517a41b0 100644
--- a/test/src/test/java/hudson/security/WhoAmITest.java
+++ b/test/src/test/java/hudson/security/WhoAmITest.java
@@ -79,7 +79,7 @@ public void whoAmI_regular_doesNotProvideSensitiveInformation() throws Exception
assertThat(sessionId, not(nullValue()));
- // dangerous stuff in Regular Login mode:
+ // dangerous stuff in Regular Login mode:
/*
*