From f689136173ac8241e2aa55aa4edf44bfc5319ae4 Mon Sep 17 00:00:00 2001 From: jlerbsc Date: Mon, 25 Mar 2024 14:11:48 +0100 Subject: [PATCH 1/3] Fix issue S1130 Exceptions in 'throws' clauses should not be superfluous --- .../main/java/hudson/util/QuotedStringTokenizer.java | 12 ++++++------ core/src/main/java/hudson/ExtensionList.java | 2 +- core/src/main/java/hudson/FilePath.java | 4 ++-- core/src/main/java/hudson/Functions.java | 2 +- core/src/main/java/hudson/Launcher.java | 2 +- .../main/java/hudson/diagnosis/OldDataMonitor.java | 2 +- .../src/main/java/hudson/logging/WeakLogHandler.java | 10 +++++----- core/src/main/java/hudson/model/AbstractBuild.java | 2 +- .../java/hudson/model/DirectlyModifiableView.java | 4 ++-- core/src/main/java/hudson/model/Items.java | 2 +- core/src/main/java/hudson/model/Queue.java | 4 ++-- core/src/main/java/hudson/model/User.java | 2 +- .../java/hudson/model/listeners/RunListener.java | 2 +- .../main/java/hudson/model/queue/Executables.java | 2 +- .../java/hudson/model/queue/MappingWorksheet.java | 2 +- .../hudson/security/ContainerAuthentication.java | 2 +- core/src/main/java/hudson/security/Permission.java | 2 +- .../main/java/hudson/security/PermissionGroup.java | 4 ++-- .../hudson/slaves/ConnectionActivityMonitor.java | 2 +- core/src/main/java/hudson/tasks/BuildWrapper.java | 4 ++-- .../main/java/hudson/util/CompoundEnumeration.java | 2 +- .../main/java/hudson/util/RemotingDiagnostics.java | 2 +- .../main/java/hudson/util/RingBufferLogHandler.java | 2 +- .../main/java/jenkins/MasterToSlaveFileCallable.java | 2 +- .../main/java/jenkins/SlaveToMasterFileCallable.java | 2 +- .../model/DirectlyModifiableTopLevelItemGroup.java | 4 ++-- core/src/main/java/jenkins/model/Jenkins.java | 12 ++++++------ .../jenkins/model/lazy/AbstractLazyLoadRunMap.java | 2 +- .../java/jenkins/security/MasterToSlaveCallable.java | 2 +- .../security/NotReallyRoleSensitiveCallable.java | 2 +- .../java/jenkins/security/SlaveToMasterCallable.java | 2 +- .../security/s2m/CallableDirectionChecker.java | 2 +- .../main/java/jenkins/tasks/SimpleBuildWrapper.java | 4 ++-- .../main/java/jenkins/util/ResourceBundleUtil.java | 4 ++-- .../src/main/java/jenkins/util/SystemProperties.java | 2 +- core/src/main/java/jenkins/util/io/PathRemover.java | 2 +- .../main/java/org/acegisecurity/Authentication.java | 4 ++-- .../org/acegisecurity/AuthenticationSpringImpl.java | 2 +- .../UsernamePasswordAuthenticationToken.java | 2 +- .../anonymous/AnonymousAuthenticationToken.java | 2 +- 40 files changed, 63 insertions(+), 63 deletions(-) diff --git a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java index 98de36ea27d8..4040d6f8d39d 100644 --- a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java +++ b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java @@ -282,8 +282,8 @@ else if (c == '\\') /* ------------------------------------------------------------ */ @Override public String nextToken() - throws NoSuchElementException - { + + { if (!hasMoreTokens() || _token == null) throw new NoSuchElementException(); String t = _token.toString(); @@ -295,8 +295,8 @@ public String nextToken() /* ------------------------------------------------------------ */ @Override public String nextToken(String delim) - throws NoSuchElementException - { + + { _delim = delim; _i = _lastStart; _token.setLength(0); @@ -314,8 +314,8 @@ public boolean hasMoreElements() /* ------------------------------------------------------------ */ @Override public Object nextElement() - throws NoSuchElementException - { + + { return nextToken(); } diff --git a/core/src/main/java/hudson/ExtensionList.java b/core/src/main/java/hudson/ExtensionList.java index c333b2de9ff2..a77f80aa76ae 100644 --- a/core/src/main/java/hudson/ExtensionList.java +++ b/core/src/main/java/hudson/ExtensionList.java @@ -158,7 +158,7 @@ public void addListener(@NonNull ExtensionListListener listener) { * * Meant to simplify call inside @Extension annotated class to retrieve their own instance. */ - public @NonNull U getInstance(@NonNull Class type) throws IllegalStateException { + public @NonNull U getInstance(@NonNull Class type) { for (T ext : this) if (ext.getClass() == type) return type.cast(ext); diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 4523e3b3276b..deb7b504a8c8 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1349,7 +1349,7 @@ public V call() throws IOException { } @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { task.checkRoles(checker); } @@ -3620,7 +3620,7 @@ public T call() throws IOException { * Role check comes from {@link FileCallable}s. */ @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { callable.checkRoles(checker); } diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index eb0f71fe20fa..4d71def74089 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -612,7 +612,7 @@ public static String getCookie(HttpServletRequest req, String name, String defau private static final Pattern ICON_SIZE = Pattern.compile("\\d+x\\d+"); @Restricted(NoExternalUse.class) - public static String validateIconSize(String iconSize) throws SecurityException { + public static String validateIconSize(String iconSize) { if (!ICON_SIZE.matcher(iconSize).matches()) { throw new SecurityException("invalid iconSize"); } diff --git a/core/src/main/java/hudson/Launcher.java b/core/src/main/java/hudson/Launcher.java index e6ba431691fb..edf6cec72bf5 100644 --- a/core/src/main/java/hudson/Launcher.java +++ b/core/src/main/java/hudson/Launcher.java @@ -1160,7 +1160,7 @@ private static final class KillTask extends MasterToSlaveCallable Iterable allItems(org.acegisecurity.Authentica * @throws IllegalArgumentException if the move would really be a rename, or the destination cannot accept the item, or the destination already has an item of that name * @since 1.548 */ - public static I move(I item, DirectlyModifiableTopLevelItemGroup destination) throws IOException, IllegalArgumentException { + public static I move(I item, DirectlyModifiableTopLevelItemGroup destination) throws IOException { DirectlyModifiableTopLevelItemGroup oldParent = (DirectlyModifiableTopLevelItemGroup) item.getParent(); if (oldParent == destination) { throw new IllegalArgumentException(); diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java index d489f042100d..494df8a1941b 100644 --- a/core/src/main/java/hudson/model/Queue.java +++ b/core/src/main/java/hudson/model/Queue.java @@ -2117,7 +2117,7 @@ public interface Executable extends Runnable { * Called by {@link Executor} to perform the task. * @throws AsynchronousExecution if you would like to continue without consuming a thread */ - @Override void run() throws AsynchronousExecution; + @Override void run(); /** * Estimate of how long will it take to execute this executable. @@ -3069,7 +3069,7 @@ public V call() throws T { } @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { delegate.checkRoles(checker); } } diff --git a/core/src/main/java/hudson/model/User.java b/core/src/main/java/hudson/model/User.java index a242385cb11a..fdde442f91bb 100644 --- a/core/src/main/java/hudson/model/User.java +++ b/core/src/main/java/hudson/model/User.java @@ -442,7 +442,7 @@ public T getProperty(Class clazz) { * Only used for a legitimate user we have no idea about. We give it only minimum access */ private static class LegitimateButUnknownUserDetails extends org.springframework.security.core.userdetails.User { - private LegitimateButUnknownUserDetails(String username) throws IllegalArgumentException { + private LegitimateButUnknownUserDetails(String username) { super( username, "", true, true, true, true, diff --git a/core/src/main/java/hudson/model/listeners/RunListener.java b/core/src/main/java/hudson/model/listeners/RunListener.java index 648a319be5d4..361ff7a6aae6 100644 --- a/core/src/main/java/hudson/model/listeners/RunListener.java +++ b/core/src/main/java/hudson/model/listeners/RunListener.java @@ -161,7 +161,7 @@ public void onStarted(R r, TaskListener listener) {} * to suppress a stack trace by the receiver. * @since 1.410 */ - public Environment setUpEnvironment(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException { + public Environment setUpEnvironment(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { return new Environment() {}; } diff --git a/core/src/main/java/hudson/model/queue/Executables.java b/core/src/main/java/hudson/model/queue/Executables.java index 396133fe4d33..13030d2f29b1 100644 --- a/core/src/main/java/hudson/model/queue/Executables.java +++ b/core/src/main/java/hudson/model/queue/Executables.java @@ -43,7 +43,7 @@ public class Executables { * @return Discovered subtask */ public static @NonNull SubTask getParentOf(@NonNull Executable e) - throws Error, RuntimeException { + throws Error { try { return e.getParent(); } catch (AbstractMethodError ignored) { // will fallback to a private implementation diff --git a/core/src/main/java/hudson/model/queue/MappingWorksheet.java b/core/src/main/java/hudson/model/queue/MappingWorksheet.java index 54829ec0dac2..3f54a864417f 100644 --- a/core/src/main/java/hudson/model/queue/MappingWorksheet.java +++ b/core/src/main/java/hudson/model/queue/MappingWorksheet.java @@ -396,6 +396,6 @@ public abstract static class ExecutorSlot { public abstract boolean isAvailable(); - protected abstract void set(WorkUnit p) throws UnsupportedOperationException; + protected abstract void set(WorkUnit p); } } diff --git a/core/src/main/java/hudson/security/ContainerAuthentication.java b/core/src/main/java/hudson/security/ContainerAuthentication.java index be7bdc01ab62..45c68e713ec3 100644 --- a/core/src/main/java/hudson/security/ContainerAuthentication.java +++ b/core/src/main/java/hudson/security/ContainerAuthentication.java @@ -99,7 +99,7 @@ public boolean isAuthenticated() { } @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + public void setAuthenticated(boolean isAuthenticated) { // noop } diff --git a/core/src/main/java/hudson/security/Permission.java b/core/src/main/java/hudson/security/Permission.java index 05d68d10ba62..c82f2dd30222 100644 --- a/core/src/main/java/hudson/security/Permission.java +++ b/core/src/main/java/hudson/security/Permission.java @@ -139,7 +139,7 @@ public final class Permission { */ public Permission(@NonNull PermissionGroup group, @NonNull String name, @CheckForNull Localizable description, @CheckForNull Permission impliedBy, boolean enable, - @NonNull PermissionScope[] scopes) throws IllegalStateException { + @NonNull PermissionScope[] scopes) { if (!JSONUtils.isJavaIdentifier(name)) throw new IllegalArgumentException(name + " is not a Java identifier"); this.owner = group.owner; diff --git a/core/src/main/java/hudson/security/PermissionGroup.java b/core/src/main/java/hudson/security/PermissionGroup.java index c9e34fdf9208..4c44dfa1d9a5 100644 --- a/core/src/main/java/hudson/security/PermissionGroup.java +++ b/core/src/main/java/hudson/security/PermissionGroup.java @@ -60,7 +60,7 @@ public final class PermissionGroup implements Iterable, Comparable

{ @Override - public Void call() throws RuntimeException { + public Void call() { return null; } diff --git a/core/src/main/java/hudson/tasks/BuildWrapper.java b/core/src/main/java/hudson/tasks/BuildWrapper.java index c4b7aa86a2d0..ec228607bf17 100644 --- a/core/src/main/java/hudson/tasks/BuildWrapper.java +++ b/core/src/main/java/hudson/tasks/BuildWrapper.java @@ -206,7 +206,7 @@ public Environment setUp(Build build, Launcher launcher, BuildListener listener) * @since 1.280 * @see LauncherDecorator */ - public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException { + public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { return launcher; } @@ -233,7 +233,7 @@ public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildLi * @since 1.374 * @see ConsoleLogFilter */ - public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException, RunnerAbortedException { + public OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException { return logger; } diff --git a/core/src/main/java/hudson/util/CompoundEnumeration.java b/core/src/main/java/hudson/util/CompoundEnumeration.java index c1679f7a26c7..7d7b5e72b188 100644 --- a/core/src/main/java/hudson/util/CompoundEnumeration.java +++ b/core/src/main/java/hudson/util/CompoundEnumeration.java @@ -38,7 +38,7 @@ public boolean hasMoreElements() { } @Override - public T nextElement() throws NoSuchElementException { + public T nextElement() { return cur.nextElement(); } } diff --git a/core/src/main/java/hudson/util/RemotingDiagnostics.java b/core/src/main/java/hudson/util/RemotingDiagnostics.java index 1756d2933b18..e8c4d7f19779 100644 --- a/core/src/main/java/hudson/util/RemotingDiagnostics.java +++ b/core/src/main/java/hudson/util/RemotingDiagnostics.java @@ -143,7 +143,7 @@ public ClassLoader getClassLoader() { @Override @SuppressFBWarnings(value = "GROOVY_SHELL", justification = "script console is a feature, not a bug") - public String call() throws RuntimeException { + public String call() { // if we run locally, cl!=null. Otherwise the delegating classloader will be available as context classloader. if (cl == null) cl = Thread.currentThread().getContextClassLoader(); CompilerConfiguration cc = new CompilerConfiguration(); diff --git a/core/src/main/java/hudson/util/RingBufferLogHandler.java b/core/src/main/java/hudson/util/RingBufferLogHandler.java index a819016cbf38..390c23142d03 100644 --- a/core/src/main/java/hudson/util/RingBufferLogHandler.java +++ b/core/src/main/java/hudson/util/RingBufferLogHandler.java @@ -121,5 +121,5 @@ public int size() { public void flush() {} @Override - public void close() throws SecurityException {} + public void close() {} } diff --git a/core/src/main/java/jenkins/MasterToSlaveFileCallable.java b/core/src/main/java/jenkins/MasterToSlaveFileCallable.java index 34afd3c11ae5..471a8769d8e8 100644 --- a/core/src/main/java/jenkins/MasterToSlaveFileCallable.java +++ b/core/src/main/java/jenkins/MasterToSlaveFileCallable.java @@ -18,7 +18,7 @@ */ public abstract class MasterToSlaveFileCallable implements FileCallable { @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { checker.check(this, Roles.SLAVE); } diff --git a/core/src/main/java/jenkins/SlaveToMasterFileCallable.java b/core/src/main/java/jenkins/SlaveToMasterFileCallable.java index d4c78dc5d07e..6e7179192a31 100644 --- a/core/src/main/java/jenkins/SlaveToMasterFileCallable.java +++ b/core/src/main/java/jenkins/SlaveToMasterFileCallable.java @@ -26,7 +26,7 @@ public abstract class SlaveToMasterFileCallable implements FileCallable { public static final Logger LOGGER = Logger.getLogger(SlaveToMasterFileCallable.class.getName()); @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { warnOnController(); checker.check(this, Roles.MASTER); } diff --git a/core/src/main/java/jenkins/model/DirectlyModifiableTopLevelItemGroup.java b/core/src/main/java/jenkins/model/DirectlyModifiableTopLevelItemGroup.java index 79f59b100f8b..bc61842db8be 100644 --- a/core/src/main/java/jenkins/model/DirectlyModifiableTopLevelItemGroup.java +++ b/core/src/main/java/jenkins/model/DirectlyModifiableTopLevelItemGroup.java @@ -53,7 +53,7 @@ public interface DirectlyModifiableTopLevelItemGroup extends ModifiableTopLevelI * @throws IOException if adding fails * @throws IllegalArgumentException if {@link #canAdd} is false, or an item with this name already exists, or this item is as yet unnamed */ - I add(I item, String name) throws IOException, IllegalArgumentException; + I add(I item, String name) throws IOException; /** * Removes an item from this group. @@ -62,6 +62,6 @@ public interface DirectlyModifiableTopLevelItemGroup extends ModifiableTopLevelI * @throws IOException if removing fails * @throws IllegalArgumentException if this was not part of the group to begin with */ - void remove(TopLevelItem item) throws IOException, IllegalArgumentException; + void remove(TopLevelItem item) throws IOException; } diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java index a35a3d486ed6..b2c1835d6d96 100644 --- a/core/src/main/java/jenkins/model/Jenkins.java +++ b/core/src/main/java/jenkins/model/Jenkins.java @@ -818,7 +818,7 @@ public interface JenkinsHolder { * @since 2.98 */ @NonNull - public static Jenkins get() throws IllegalStateException { + public static Jenkins get() { Jenkins instance = getInstanceOrNull(); if (instance == null) { throw new IllegalStateException("Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong."); @@ -832,7 +832,7 @@ public static Jenkins get() throws IllegalStateException { */ @Deprecated @NonNull - public static Jenkins getActiveInstance() throws IllegalStateException { + public static Jenkins getActiveInstance() { return get(); } @@ -2514,7 +2514,7 @@ public String getUrlChildPrefix() { * @since 1.66 * @see Hyperlinks in HTML */ - public @Nullable String getRootUrl() throws IllegalStateException { + public @Nullable String getRootUrl() { final JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get(); String url = config.getUrl(); if (url != null) { @@ -3042,7 +3042,7 @@ public InitMilestone getInitLevel() { * @throws IOException Failed to save the configuration * @throws IllegalArgumentException Negative value has been passed */ - public void setNumExecutors(/* @javax.annotation.Nonnegative*/ int n) throws IOException, IllegalArgumentException { + public void setNumExecutors(/* @javax.annotation.Nonnegative*/ int n) throws IOException { if (n < 0) { throw new IllegalArgumentException("Incorrect field \"# of executors\": " + n + ". It should be a non-negative number."); } @@ -3282,7 +3282,7 @@ public void onDeleted(TopLevelItem item) throws IOException { return true; } - @Override public synchronized I add(I item, String name) throws IOException, IllegalArgumentException { + @Override public synchronized I add(I item, String name) throws IOException { if (items.containsKey(name)) { throw new IllegalArgumentException("already an item '" + name + "'"); } @@ -3290,7 +3290,7 @@ public void onDeleted(TopLevelItem item) throws IOException { return item; } - @Override public void remove(TopLevelItem item) throws IOException, IllegalArgumentException { + @Override public void remove(TopLevelItem item) throws IOException { items.remove(item.getName()); } diff --git a/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java b/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java index ec2486bc3d3c..c6ac7a7f2ec5 100644 --- a/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java +++ b/core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java @@ -592,7 +592,7 @@ public synchronized int maxNumberOnDisk() { return numberOnDisk.max(); } - protected final synchronized void proposeNewNumber(int number) throws IllegalStateException { + protected final synchronized void proposeNewNumber(int number) { if (number <= maxNumberOnDisk()) { throw new IllegalStateException("JENKINS-27530: cannot create a build with number " + number + " since that (or higher) is already in use among " + numberOnDisk); } diff --git a/core/src/main/java/jenkins/security/MasterToSlaveCallable.java b/core/src/main/java/jenkins/security/MasterToSlaveCallable.java index db0406bcf548..f58babb3029b 100644 --- a/core/src/main/java/jenkins/security/MasterToSlaveCallable.java +++ b/core/src/main/java/jenkins/security/MasterToSlaveCallable.java @@ -19,7 +19,7 @@ public abstract class MasterToSlaveCallable implements C private static final long serialVersionUID = 1L; @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { checker.check(this, Roles.SLAVE); } } diff --git a/core/src/main/java/jenkins/security/NotReallyRoleSensitiveCallable.java b/core/src/main/java/jenkins/security/NotReallyRoleSensitiveCallable.java index 1d5cf2c3f701..81020ec87ccd 100644 --- a/core/src/main/java/jenkins/security/NotReallyRoleSensitiveCallable.java +++ b/core/src/main/java/jenkins/security/NotReallyRoleSensitiveCallable.java @@ -12,7 +12,7 @@ */ public abstract class NotReallyRoleSensitiveCallable implements Callable { @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { // not meant to be used where this matters throw new UnsupportedOperationException(); } diff --git a/core/src/main/java/jenkins/security/SlaveToMasterCallable.java b/core/src/main/java/jenkins/security/SlaveToMasterCallable.java index 0580b3fc393f..0b251990a537 100644 --- a/core/src/main/java/jenkins/security/SlaveToMasterCallable.java +++ b/core/src/main/java/jenkins/security/SlaveToMasterCallable.java @@ -11,7 +11,7 @@ */ public abstract class SlaveToMasterCallable implements Callable { @Override - public void checkRoles(RoleChecker checker) throws SecurityException { + public void checkRoles(RoleChecker checker) { checker.check(this, Roles.MASTER); } diff --git a/core/src/main/java/jenkins/security/s2m/CallableDirectionChecker.java b/core/src/main/java/jenkins/security/s2m/CallableDirectionChecker.java index f3f36eb51ac5..1e351b43aa6f 100644 --- a/core/src/main/java/jenkins/security/s2m/CallableDirectionChecker.java +++ b/core/src/main/java/jenkins/security/s2m/CallableDirectionChecker.java @@ -39,7 +39,7 @@ public class CallableDirectionChecker extends RoleChecker { public static boolean BYPASS = SystemProperties.getBoolean(BYPASS_PROP); @Override - public void check(RoleSensitive subject, @NonNull Collection expected) throws SecurityException { + public void check(RoleSensitive subject, @NonNull Collection expected) { final String name = subject.getClass().getName(); if (expected.contains(Roles.MASTER)) { diff --git a/core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java b/core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java index 7d18f72b860a..a09873418d32 100644 --- a/core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java +++ b/core/src/main/java/jenkins/tasks/SimpleBuildWrapper.java @@ -339,7 +339,7 @@ private class EnvironmentWrapper extends Environment { return null; } - @Override public final OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException, Run.RunnerAbortedException { + @Override public final OutputStream decorateLogger(AbstractBuild build, OutputStream logger) throws IOException, InterruptedException { ConsoleLogFilter filter = createLoggerDecorator(build); return filter != null ? filter.decorateLogger(build, logger) : logger; } @@ -349,7 +349,7 @@ private class EnvironmentWrapper extends Environment { *

{@inheritDoc} * @since 1.608 */ - @Override public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException { + @Override public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { return super.decorateLauncher(build, launcher, listener); // TODO reasonable to decorate Launcher within a dynamic scope, but this signature does not mix well with Context pattern. // Called from AbstractBuildExecution.createLauncher; how do we track what is decorating what? diff --git a/core/src/main/java/jenkins/util/ResourceBundleUtil.java b/core/src/main/java/jenkins/util/ResourceBundleUtil.java index f9f9310f5662..7adeec32fa1b 100644 --- a/core/src/main/java/jenkins/util/ResourceBundleUtil.java +++ b/core/src/main/java/jenkins/util/ResourceBundleUtil.java @@ -54,7 +54,7 @@ private ResourceBundleUtil() { * @return The bundle JSON. * @throws MissingResourceException Missing resource bundle. */ - public static @NonNull JSONObject getBundle(@NonNull String baseName) throws MissingResourceException { + public static @NonNull JSONObject getBundle(@NonNull String baseName) { return getBundle(baseName, Locale.getDefault()); } @@ -65,7 +65,7 @@ private ResourceBundleUtil() { * @return The bundle JSON. * @throws MissingResourceException Missing resource bundle. */ - public static @NonNull JSONObject getBundle(@NonNull String baseName, @NonNull Locale locale) throws MissingResourceException { + public static @NonNull JSONObject getBundle(@NonNull String baseName, @NonNull Locale locale) { var bundleKey = baseName + ":" + locale; var bundleJSON = bundles.get(bundleKey); diff --git a/core/src/main/java/jenkins/util/SystemProperties.java b/core/src/main/java/jenkins/util/SystemProperties.java index d32a91e2db79..a4a1bc51255d 100644 --- a/core/src/main/java/jenkins/util/SystemProperties.java +++ b/core/src/main/java/jenkins/util/SystemProperties.java @@ -153,7 +153,7 @@ private static final class CopySystemProperties extends MasterToSlaveCallable {}; } diff --git a/core/src/main/java/org/acegisecurity/Authentication.java b/core/src/main/java/org/acegisecurity/Authentication.java index c331564f664e..44051ed6bf90 100644 --- a/core/src/main/java/org/acegisecurity/Authentication.java +++ b/core/src/main/java/org/acegisecurity/Authentication.java @@ -49,7 +49,7 @@ public interface Authentication extends Principal, Serializable { boolean isAuthenticated(); - void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException; + void setAuthenticated(boolean isAuthenticated); static @NonNull Authentication fromSpring(@NonNull org.springframework.security.core.Authentication a) { Objects.requireNonNull(a); @@ -90,7 +90,7 @@ public boolean isAuthenticated() { } @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + public void setAuthenticated(boolean isAuthenticated) { a.setAuthenticated(isAuthenticated); } diff --git a/core/src/main/java/org/acegisecurity/AuthenticationSpringImpl.java b/core/src/main/java/org/acegisecurity/AuthenticationSpringImpl.java index c2c8216ddc83..958c4bf87010 100644 --- a/core/src/main/java/org/acegisecurity/AuthenticationSpringImpl.java +++ b/core/src/main/java/org/acegisecurity/AuthenticationSpringImpl.java @@ -62,7 +62,7 @@ public boolean isAuthenticated() { } @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + public void setAuthenticated(boolean isAuthenticated) { delegate.setAuthenticated(isAuthenticated); } diff --git a/core/src/main/java/org/acegisecurity/providers/UsernamePasswordAuthenticationToken.java b/core/src/main/java/org/acegisecurity/providers/UsernamePasswordAuthenticationToken.java index ad56d529c026..69448aa693fa 100644 --- a/core/src/main/java/org/acegisecurity/providers/UsernamePasswordAuthenticationToken.java +++ b/core/src/main/java/org/acegisecurity/providers/UsernamePasswordAuthenticationToken.java @@ -82,7 +82,7 @@ public boolean isAuthenticated() { } @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + public void setAuthenticated(boolean isAuthenticated) { delegate.setAuthenticated(isAuthenticated); } diff --git a/core/src/main/java/org/acegisecurity/providers/anonymous/AnonymousAuthenticationToken.java b/core/src/main/java/org/acegisecurity/providers/anonymous/AnonymousAuthenticationToken.java index a60e9865ce2d..a0843664f980 100644 --- a/core/src/main/java/org/acegisecurity/providers/anonymous/AnonymousAuthenticationToken.java +++ b/core/src/main/java/org/acegisecurity/providers/anonymous/AnonymousAuthenticationToken.java @@ -79,7 +79,7 @@ public boolean isAuthenticated() { } @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + public void setAuthenticated(boolean isAuthenticated) { delegate.setAuthenticated(isAuthenticated); } From 7d5831f869c3e58a95336994877d8a633175b93c Mon Sep 17 00:00:00 2001 From: jean pierre Lerbscher <5850581+jlerbsc@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:03:58 +0100 Subject: [PATCH 2/3] Update QuotedStringTokenizer.java Correcting code formatting --- cli/src/main/java/hudson/util/QuotedStringTokenizer.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java index 4040d6f8d39d..ed24ce0d3e29 100644 --- a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java +++ b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java @@ -282,8 +282,7 @@ else if (c == '\\') /* ------------------------------------------------------------ */ @Override public String nextToken() - - { + { if (!hasMoreTokens() || _token == null) throw new NoSuchElementException(); String t = _token.toString(); @@ -295,8 +294,7 @@ public String nextToken() /* ------------------------------------------------------------ */ @Override public String nextToken(String delim) - - { + { _delim = delim; _i = _lastStart; _token.setLength(0); @@ -314,8 +312,7 @@ public boolean hasMoreElements() /* ------------------------------------------------------------ */ @Override public Object nextElement() - - { + { return nextToken(); } From b9d383af0c184de4cd3f5c1c01a8d52f951e4f40 Mon Sep 17 00:00:00 2001 From: jean pierre Lerbscher <5850581+jlerbsc@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:38:23 +0100 Subject: [PATCH 3/3] Update CompoundEnumeration.java Remove the unnecessary import of NoSuchElementException --- core/src/main/java/hudson/util/CompoundEnumeration.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/hudson/util/CompoundEnumeration.java b/core/src/main/java/hudson/util/CompoundEnumeration.java index 7d7b5e72b188..f6ceb834e218 100644 --- a/core/src/main/java/hudson/util/CompoundEnumeration.java +++ b/core/src/main/java/hudson/util/CompoundEnumeration.java @@ -4,7 +4,6 @@ import java.util.Collections; import java.util.Enumeration; import java.util.Iterator; -import java.util.NoSuchElementException; /** * {@link Enumeration} that aggregates multiple {@link Enumeration}s.