diff --git a/cli/src/main/java/hudson/cli/CLI.java b/cli/src/main/java/hudson/cli/CLI.java index 24a9d07c61..862847df96 100644 --- a/cli/src/main/java/hudson/cli/CLI.java +++ b/cli/src/main/java/hudson/cli/CLI.java @@ -189,9 +189,9 @@ public class CLI { 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/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 8612e35e2d..982f8e7ecd 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -2364,9 +2364,9 @@ public final class FilePath implements SerializableOnlyOverRemoting { * 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 { @@ -2695,14 +2695,14 @@ public final class FilePath implements SerializableOnlyOverRemoting { } } 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() { diff --git a/core/src/main/java/hudson/Launcher.java b/core/src/main/java/hudson/Launcher.java index c08c46d294..5b67208c5c 100644 --- a/core/src/main/java/hudson/Launcher.java +++ b/core/src/main/java/hudson/Launcher.java @@ -987,7 +987,7 @@ public abstract class Launcher { // 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, diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java index 395b32bf6f..9b9f381465 100644 --- a/core/src/main/java/hudson/PluginManager.java +++ b/core/src/main/java/hudson/PluginManager.java @@ -1183,31 +1183,31 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas * 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"); - } + 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); + // default and fallback + return new ClassicPluginStrategy(this); } public PluginStrategy getPluginStrategy() { @@ -1498,8 +1498,8 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas 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()); diff --git a/core/src/main/java/hudson/PluginWrapper.java b/core/src/main/java/hudson/PluginWrapper.java index fb555cbaf9..5e0f24a12e 100644 --- a/core/src/main/java/hudson/PluginWrapper.java +++ b/core/src/main/java/hudson/PluginWrapper.java @@ -485,17 +485,17 @@ public class PluginWrapper implements Comparable, ModelObject { * @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) { + 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 class PluginWrapper implements Comparable, ModelObject { 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 class PluginWrapper implements Comparable, ModelObject { // 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 @@ public class PluginWrapper implements Comparable, ModelObject { return uiList.stream().allMatch(k -> k.wiki != null && k.wiki.equals(url)); } - @Override + @Override public String toString() { return "Plugin:" + getShortName(); } diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index 5df8db73ff..6aeab1720c 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -301,7 +301,7 @@ public class WebAppMain implements ServletContextListener { JellyFacet.setExpressionFactory(event, new ExpressionFactory2()); } - /** + /** * Installs log handler to monitor all Hudson logs. */ private void installLogger() { diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java index d4bb7fa4a1..a6ea4845b0 100644 --- a/core/src/main/java/hudson/model/AbstractBuild.java +++ b/core/src/main/java/hudson/model/AbstractBuild.java @@ -883,7 +883,7 @@ public abstract class AbstractBuild

,R extends Abs } } - /* + /* * No need to lock the entire AbstractBuild on change set calculation */ private transient Object changeSetLock = new Object(); diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index 48666d0bad..cd669b8bb4 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -1105,7 +1105,7 @@ public abstract class AbstractProject

,R extends A 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 abstract class AbstractProject

,R extends A 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 abstract class AbstractProject

,R extends A } 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 e69062c7cb..4fd5e23107 100644 --- a/core/src/main/java/hudson/model/AperiodicWork.java +++ b/core/src/main/java/hudson/model/AperiodicWork.java @@ -52,7 +52,7 @@ import jenkins.util.Timer; @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. @@ -88,7 +88,7 @@ public abstract class AperiodicWork extends SafeTimerTask implements ExtensionPo @Override public final void doRun() throws Exception{ - doAperiodicRun(); + doAperiodicRun(); Timer.get().schedule(getNewInstance(), getRecurrencePeriod(), TimeUnit.MILLISECONDS); } diff --git a/core/src/main/java/hudson/model/PaneStatusProperties.java b/core/src/main/java/hudson/model/PaneStatusProperties.java index a89c28d3e9..29a4603494 100644 --- a/core/src/main/java/hudson/model/PaneStatusProperties.java +++ b/core/src/main/java/hudson/model/PaneStatusProperties.java @@ -11,83 +11,83 @@ import org.kohsuke.stapler.Stapler; public class PaneStatusProperties extends UserProperty implements Saveable { - private final PersistedList collapsed = new PersistedList<>(this); + private final PersistedList collapsed = new PersistedList<>(this); - private static final PaneStatusProperties FALLBACK = new PaneStatusPropertiesSessionFallback(); + private static final PaneStatusProperties FALLBACK = new PaneStatusPropertiesSessionFallback(); - public boolean isCollapsed(String paneId) { - return collapsed.contains(paneId); - } + 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; - } - } + /** + * @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 { + @Override + public void save() throws IOException { user.save(); } - private Object readResolve() { - collapsed.setOwner(this); - return this; - } + private Object readResolve() { + collapsed.setOwner(this); + return this; + } - @Extension @Symbol("paneStatus") - public static class DescriptorImpl extends UserPropertyDescriptor { + @Extension @Symbol("paneStatus") + public static class DescriptorImpl extends UserPropertyDescriptor { - @Override - public UserProperty newInstance(User user) { - return new PaneStatusProperties(); - } + @Override + public UserProperty newInstance(User user) { + return new PaneStatusProperties(); + } - @Override - public boolean isEnabled() { - return false; - } + @Override + public boolean isEnabled() { + return false; + } - } + } - private static class PaneStatusPropertiesSessionFallback extends PaneStatusProperties { + private static class PaneStatusPropertiesSessionFallback extends PaneStatusProperties { - private static final String attribute = "jenkins_pane_%s_collapsed"; + 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 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; - } - } + @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); - } + 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 d504a9fdc6..7470330c7a 100644 --- a/core/src/main/java/hudson/model/ParametersDefinitionProperty.java +++ b/core/src/main/java/hudson/model/ParametersDefinitionProperty.java @@ -161,7 +161,7 @@ public class ParametersDefinitionProperty extends OptionalJobProperty> } } - 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 class ParametersDefinitionProperty extends OptionalJobProperty> 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)); diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 6ad95767b1..fa8500367c 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -1355,7 +1355,7 @@ public abstract class Run ,RunT extends Run,RunT extends Run,RunT extends Run,RunT extends Run { 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(); } diff --git a/core/src/main/java/hudson/util/ProcessTree.java b/core/src/main/java/hudson/util/ProcessTree.java index d289b5ffa8..37f10c8cd2 100644 --- a/core/src/main/java/hudson/util/ProcessTree.java +++ b/core/src/main/java/hudson/util/ProcessTree.java @@ -1121,44 +1121,44 @@ public abstract class ProcessTree implements Iterable, IProcessTree, 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; @@ -1535,9 +1535,9 @@ public abstract class ProcessTree implements Iterable, IProcessTree, 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 abstract class ProcessTree implements Iterable, IProcessTree, 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); diff --git a/core/src/main/java/jenkins/install/InstallUtil.java b/core/src/main/java/jenkins/install/InstallUtil.java index cf02591f7a..3cd4079e93 100644 --- a/core/src/main/java/jenkins/install/InstallUtil.java +++ b/core/src/main/java/jenkins/install/InstallUtil.java @@ -280,10 +280,10 @@ public class InstallUtil { * 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 @@ public class InstallUtil { */ 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 class InstallUtil { /** * Call to remove any active install status */ - public static void clearInstallStatus() { - persistInstallStatus(null); - } + public static void clearInstallStatus() { + persistInstallStatus(null); + } } diff --git a/core/src/test/java/hudson/UtilTest.java b/core/src/test/java/hudson/UtilTest.java index 253b7b7a32..2eed7e9c86 100644 --- a/core/src/test/java/hudson/UtilTest.java +++ b/core/src/test/java/hudson/UtilTest.java @@ -100,7 +100,7 @@ public class UtilTest { 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 class UtilTest { @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 string; + private String expectedDigest; - private String error; + private String error; - DigesterThread(String string, String expectedDigest) { - this.string = string; - this.expectedDigest = expectedDigest; - } + 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; - } - } - } + @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/tasks/_maven/Maven3MojoNoteTest.java b/core/src/test/java/hudson/tasks/_maven/Maven3MojoNoteTest.java index c063c813b5..e67f1ea004 100644 --- a/core/src/test/java/hudson/tasks/_maven/Maven3MojoNoteTest.java +++ b/core/src/test/java/hudson/tasks/_maven/Maven3MojoNoteTest.java @@ -8,26 +8,26 @@ import org.junit.Test; public class Maven3MojoNoteTest { - @Test - public void testAnnotateMavenPlugin() { - check("[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---", "[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---"); - } + @Test + public void testAnnotateMavenPlugin() { + check("[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---", "[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jobConfigHistory ---"); + } - @Test - public void testAnnotateCodehausPlugin() { - check("[INFO] --- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---", "[INFO] --- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---"); + @Test + public void testAnnotateCodehausPlugin() { + check("[INFO] --- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---", "[INFO] --- cobertura-maven-plugin:2.4:instrument (report:cobertura) @ sardine ---"); - } + } - @Test - public void testAnnotateOtherPlugin() { - check("[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---", "[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---"); - } + @Test + public void testAnnotateOtherPlugin() { + check("[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---", "[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ jobConfigHistory ---"); + } - private void check(final String decorated, final String input) { - assertTrue(input + " does not match" + Maven3MojoNote.PATTERN, Maven3MojoNote.PATTERN.matcher(input).matches()); - assertEquals(decorated, annotate(input)); - } + private void check(final String decorated, final String input) { + assertTrue(input + " does not match" + Maven3MojoNote.PATTERN, Maven3MojoNote.PATTERN.matcher(input).matches()); + assertEquals(decorated, annotate(input)); + } private String annotate(String text) { final MarkupText markupText = new MarkupText(text); diff --git a/core/src/test/java/hudson/util/RunListTest.java b/core/src/test/java/hudson/util/RunListTest.java index 5c61948b31..53d08e1760 100644 --- a/core/src/test/java/hudson/util/RunListTest.java +++ b/core/src/test/java/hudson/util/RunListTest.java @@ -37,53 +37,53 @@ import org.jvnet.hudson.test.Issue; */ public class RunListTest { - // RunList for byTimestamp tests - private RunList rlist; + // RunList for byTimestamp tests + private RunList rlist; - // RunList is ordered from most to least recent - private void setUpByTimestampRuns() { - Run r1 = mock(Run.class); - Run r2 = mock(Run.class); + // RunList is ordered from most to least recent + private void setUpByTimestampRuns() { + Run r1 = mock(Run.class); + Run r2 = mock(Run.class); - when(r1.getNumber()).thenReturn(1); - when(r2.getNumber()).thenReturn(2); + when(r1.getNumber()).thenReturn(1); + when(r2.getNumber()).thenReturn(2); - when(r1.getTimeInMillis()).thenReturn(200L); - when(r2.getTimeInMillis()).thenReturn(300L); + when(r1.getTimeInMillis()).thenReturn(200L); + when(r2.getTimeInMillis()).thenReturn(300L); - ArrayList list = new ArrayList<>(); - list.add(r2); - list.add(r1); + ArrayList list = new ArrayList<>(); + list.add(r2); + list.add(r1); - rlist = RunList.fromRuns(list); - } + rlist = RunList.fromRuns(list); + } - @Test - public void byTimestampAllRuns() { - setUpByTimestampRuns(); + @Test + public void byTimestampAllRuns() { + setUpByTimestampRuns(); - RunList tested = rlist.byTimestamp(0, 400); - assertEquals(2, tested.toArray().length); - } + RunList tested = rlist.byTimestamp(0, 400); + assertEquals(2, tested.toArray().length); + } @Issue("JENKINS-21159") - @Test - @SuppressWarnings("deprecation") - public void byTimestampFirstRun() { - setUpByTimestampRuns(); - // Only r1 - RunList tested = rlist.byTimestamp(150, 250); - assertEquals(1, tested.toArray().length); - assertEquals(1, tested.getFirstBuild().getNumber()); - } + @Test + @SuppressWarnings("deprecation") + public void byTimestampFirstRun() { + setUpByTimestampRuns(); + // Only r1 + RunList tested = rlist.byTimestamp(150, 250); + assertEquals(1, tested.toArray().length); + assertEquals(1, tested.getFirstBuild().getNumber()); + } - @Test - @SuppressWarnings("deprecation") - public void byTimestampLastRun() { - setUpByTimestampRuns(); - // Only r2 - RunList tested = rlist.byTimestamp(250, 350); - assertEquals(1, tested.toArray().length); - assertEquals(2, tested.getFirstBuild().getNumber()); - } + @Test + @SuppressWarnings("deprecation") + public void byTimestampLastRun() { + setUpByTimestampRuns(); + // Only r2 + RunList tested = rlist.byTimestamp(250, 350); + assertEquals(1, tested.toArray().length); + assertEquals(2, tested.getFirstBuild().getNumber()); + } } diff --git a/pom.xml b/pom.xml index 5469db96d4..33853e1a33 100644 --- a/pom.xml +++ b/pom.xml @@ -514,6 +514,9 @@ THE SOFTWARE. + + true + diff --git a/test/src/test/java/hudson/PluginManagerTest.java b/test/src/test/java/hudson/PluginManagerTest.java index 444fe1222a..06e4722b0b 100644 --- a/test/src/test/java/hudson/PluginManagerTest.java +++ b/test/src/test/java/hudson/PluginManagerTest.java @@ -525,16 +525,16 @@ public class PluginManagerTest { // 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/model/AbstractBuildTest.java b/test/src/test/java/hudson/model/AbstractBuildTest.java index c9d74de92b..6c0f2afe44 100644 --- a/test/src/test/java/hudson/model/AbstractBuildTest.java +++ b/test/src/test/java/hudson/model/AbstractBuildTest.java @@ -118,10 +118,10 @@ public class AbstractBuildTest { 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/HelpLinkTest.java b/test/src/test/java/hudson/model/HelpLinkTest.java index 4f3a2e67a6..1b80664ec1 100644 --- a/test/src/test/java/hudson/model/HelpLinkTest.java +++ b/test/src/test/java/hudson/model/HelpLinkTest.java @@ -32,15 +32,15 @@ import org.jvnet.hudson.test.JenkinsRule; "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/slaves/EnvironmentVariableNodePropertyTest.java b/test/src/test/java/hudson/slaves/EnvironmentVariableNodePropertyTest.java index 7d05271183..93edbc76b0 100644 --- a/test/src/test/java/hudson/slaves/EnvironmentVariableNodePropertyTest.java +++ b/test/src/test/java/hudson/slaves/EnvironmentVariableNodePropertyTest.java @@ -29,147 +29,147 @@ import org.jvnet.hudson.test.JenkinsRule.WebClient; */ public class EnvironmentVariableNodePropertyTest { - @ClassRule - public static BuildWatcher buildWatcher = new BuildWatcher(); + @ClassRule + public static BuildWatcher buildWatcher = new BuildWatcher(); - @Rule - public JenkinsRule j = new JenkinsRule(); + @Rule + public JenkinsRule j = new JenkinsRule(); - private DumbSlave agent; - private FreeStyleProject project; + private DumbSlave agent; + private FreeStyleProject project; - /** - * Agent properties are available - */ - @Test - public void testAgentPropertyOnAgent() throws Exception { - setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "agentValue")); - Map envVars = executeBuild(agent); - assertEquals("agentValue", envVars.get("KEY")); - } + /** + * Agent properties are available + */ + @Test + public void testAgentPropertyOnAgent() throws Exception { + setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "agentValue")); + Map envVars = executeBuild(agent); + assertEquals("agentValue", envVars.get("KEY")); + } - /** - * Built-in node properties are available - */ - @Test - public void testControllerPropertyOnBuiltInNode() throws Exception { + /** + * Built-in node properties are available + */ + @Test + public void testControllerPropertyOnBuiltInNode() throws Exception { j.jenkins.getGlobalNodeProperties().replaceBy( Collections.singleton(new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("KEY", "globalValue")))); - Map envVars = executeBuild(j.jenkins); + Map envVars = executeBuild(j.jenkins); - assertEquals("globalValue", envVars.get("KEY")); - } + assertEquals("globalValue", envVars.get("KEY")); + } - /** - * Both agent and controller properties are available, but agent properties have priority - */ - @Test - public void testAgentAndControllerPropertyOnAgent() throws Exception { + /** + * Both agent and controller properties are available, but agent properties have priority + */ + @Test + public void testAgentAndControllerPropertyOnAgent() throws Exception { j.jenkins.getGlobalNodeProperties().replaceBy( Collections.singleton(new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("KEY", "globalValue")))); - setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "agentValue")); + setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "agentValue")); - Map envVars = executeBuild(agent); + Map envVars = executeBuild(agent); - assertEquals("agentValue", envVars.get("KEY")); - } + assertEquals("agentValue", envVars.get("KEY")); + } - /** - * Agent and controller properties and parameters are available. - * Priority: parameters > agent > controller - */ - @Test - // TODO(terminology) is this correct? This sets a built-in node property, not a global property - public void testAgentAndBuiltInNodePropertyAndParameterOnAgent() - throws Exception { - ParametersDefinitionProperty pdp = new ParametersDefinitionProperty( - new StringParameterDefinition("KEY", "parameterValue")); - project.addProperty(pdp); + /** + * Agent and controller properties and parameters are available. + * Priority: parameters > agent > controller + */ + @Test + // TODO(terminology) is this correct? This sets a built-in node property, not a global property + public void testAgentAndBuiltInNodePropertyAndParameterOnAgent() + throws Exception { + ParametersDefinitionProperty pdp = new ParametersDefinitionProperty( + new StringParameterDefinition("KEY", "parameterValue")); + project.addProperty(pdp); - setVariables(j.jenkins, new EnvironmentVariablesNodeProperty.Entry("KEY", "builtInNodeValue")); - setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "agentValue")); + setVariables(j.jenkins, new EnvironmentVariablesNodeProperty.Entry("KEY", "builtInNodeValue")); + setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "agentValue")); - Map envVars = executeBuild(agent); + Map envVars = executeBuild(agent); - assertEquals("parameterValue", envVars.get("KEY")); - } + assertEquals("parameterValue", envVars.get("KEY")); + } - @Test - public void testVariableResolving() throws Exception { + @Test + public void testVariableResolving() throws Exception { j.jenkins.getGlobalNodeProperties().replaceBy( Collections.singleton(new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("KEY1", "value"), new EnvironmentVariablesNodeProperty.Entry("KEY2", "$KEY1")))); - Map envVars = executeBuild(j.jenkins); - assertEquals("value", envVars.get("KEY1")); - assertEquals("value", envVars.get("KEY2")); - } + Map envVars = executeBuild(j.jenkins); + assertEquals("value", envVars.get("KEY1")); + assertEquals("value", envVars.get("KEY2")); + } - @Test - public void testFormRoundTripForController() throws Exception { + @Test + public void testFormRoundTripForController() throws Exception { j.jenkins.getGlobalNodeProperties().replaceBy( Collections.singleton(new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("KEY", "value")))); - WebClient webClient = j.createWebClient(); - HtmlPage page = webClient.getPage(j.jenkins, "configure"); - HtmlForm form = page.getFormByName("config"); - j.submit(form); + WebClient webClient = j.createWebClient(); + HtmlPage page = webClient.getPage(j.jenkins, "configure"); + HtmlForm form = page.getFormByName("config"); + j.submit(form); - assertEquals(1, j.jenkins.getGlobalNodeProperties().toList().size()); + assertEquals(1, j.jenkins.getGlobalNodeProperties().toList().size()); - EnvironmentVariablesNodeProperty prop = j.jenkins.getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); - assertEquals(1, prop.getEnvVars().size()); - assertEquals("value", prop.getEnvVars().get("KEY")); - } + EnvironmentVariablesNodeProperty prop = j.jenkins.getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); + assertEquals(1, prop.getEnvVars().size()); + assertEquals("value", prop.getEnvVars().get("KEY")); + } - @Test - public void testFormRoundTripForAgent() throws Exception { - setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "value")); + @Test + public void testFormRoundTripForAgent() throws Exception { + setVariables(agent, new EnvironmentVariablesNodeProperty.Entry("KEY", "value")); - WebClient webClient = j.createWebClient(); - HtmlPage page = webClient.getPage(agent, "configure"); - HtmlForm form = page.getFormByName("config"); - j.submit(form); + WebClient webClient = j.createWebClient(); + HtmlPage page = webClient.getPage(agent, "configure"); + HtmlForm form = page.getFormByName("config"); + j.submit(form); - assertEquals(1, agent.getNodeProperties().toList().size()); + assertEquals(1, agent.getNodeProperties().toList().size()); - EnvironmentVariablesNodeProperty prop = agent.getNodeProperties().get(EnvironmentVariablesNodeProperty.class); - assertEquals(1, prop.getEnvVars().size()); - assertEquals("value", prop.getEnvVars().get("KEY")); - } + EnvironmentVariablesNodeProperty prop = agent.getNodeProperties().get(EnvironmentVariablesNodeProperty.class); + assertEquals(1, prop.getEnvVars().size()); + assertEquals("value", prop.getEnvVars().get("KEY")); + } - // //////////////////////// setup ////////////////////////////////////////// + // //////////////////////// setup ////////////////////////////////////////// - @Before - public void setUp() throws Exception { - agent = j.createSlave(); - project = j.createFreeStyleProject(); - } + @Before + public void setUp() throws Exception { + agent = j.createSlave(); + project = j.createFreeStyleProject(); + } - // ////////////////////// helper methods ///////////////////////////////// + // ////////////////////// helper methods ///////////////////////////////// - private void setVariables(Node node, EnvironmentVariablesNodeProperty.Entry... entries) throws IOException { - node.getNodeProperties().replaceBy( - Collections.singleton(new EnvironmentVariablesNodeProperty( - entries))); + private void setVariables(Node node, EnvironmentVariablesNodeProperty.Entry... entries) throws IOException { + node.getNodeProperties().replaceBy( + Collections.singleton(new EnvironmentVariablesNodeProperty( + entries))); - } + } - /** - * Launches project on this node, waits for the result, and returns the environment that is used - */ - private Map executeBuild(Node node) throws Exception { - CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder(); + /** + * Launches project on this node, waits for the result, and returns the environment that is used + */ + private Map executeBuild(Node node) throws Exception { + CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder(); - project.getBuildersList().add(builder); - project.setAssignedLabel(node.getSelfLabel()); + project.getBuildersList().add(builder); + project.setAssignedLabel(node.getSelfLabel()); - FreeStyleBuild build = j.buildAndAssertSuccess(project); + FreeStyleBuild build = j.buildAndAssertSuccess(project); - return builder.getEnvVars(); - } + return builder.getEnvVars(); + } } diff --git a/test/src/test/java/hudson/tasks/MavenTest.java b/test/src/test/java/hudson/tasks/MavenTest.java index 6abd031cb8..cb6e35d98c 100644 --- a/test/src/test/java/hudson/tasks/MavenTest.java +++ b/test/src/test/java/hudson/tasks/MavenTest.java @@ -95,7 +95,7 @@ public class MavenTest { assertEquals("b.pom", m.pom); assertEquals("c=d", m.properties); assertEquals("-e", m.jvmOptions); - assertTrue(m.usesPrivateRepository()); + assertTrue(m.usesPrivateRepository()); } @Test public void withNodeProperty() throws Exception { diff --git a/test/src/test/java/jenkins/model/JenkinsBuildsAndWorkspacesDirectoriesTest.java b/test/src/test/java/jenkins/model/JenkinsBuildsAndWorkspacesDirectoriesTest.java index f5e6c471eb..c3f476e6a4 100644 --- a/test/src/test/java/jenkins/model/JenkinsBuildsAndWorkspacesDirectoriesTest.java +++ b/test/src/test/java/jenkins/model/JenkinsBuildsAndWorkspacesDirectoriesTest.java @@ -275,10 +275,10 @@ public class JenkinsBuildsAndWorkspacesDirectoriesTest { .anyMatch(record -> record.getMessage().contains(searched)); } - private boolean logWasFoundAtLevel(String searched, Level level) { - return loggerRule.getRecords().stream() + private boolean logWasFoundAtLevel(String searched, Level level) { + return loggerRule.getRecords().stream() .filter(record -> record.getMessage().contains(searched)).anyMatch(record -> record.getLevel().equals(level)); - } + } @Test @Issue("JENKINS-17138")