Skip to content

Commit d6ae31d

Browse files
Cleanup migrations (move comments, formatting, spotbugs...)
1 parent a474bde commit d6ae31d

File tree

17 files changed

+42
-39
lines changed

17 files changed

+42
-39
lines changed

cli/src/main/java/hudson/cli/CLI.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ public static int _main(String[] _args) throws Exception {
174174
printUsage("-remoting mode is no longer supported");
175175
return -1;
176176
}
177+
default -> {
178+
// continue
179+
}
177180
}
178181
if (head.equals("-s") && args.size() >= 2) {
179182
url = args.get(1);

core/src/main/java/hudson/PluginManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ public void run(Reactor session) throws Exception {
583583

584584
// schedule execution of loading plugins
585585
for (final PluginWrapper p : activePlugins.toArray(new PluginWrapper[0])) {
586-
g.followedBy().notFatal().attains(PLUGINS_PREPARED).add(String.format("Loading plugin %s v%s (%s)", p.getLongName(), p.getVersion(), p.getShortName()), session3 -> {
586+
g.followedBy().notFatal().attains(PLUGINS_PREPARED).add(String.format("Loading plugin %s v%s (%s)", p.getLongName(), p.getVersion(), p.getShortName()), reactor -> {
587587
try {
588588
p.resolvePluginDependencies();
589589
strategy.load(p);
@@ -605,7 +605,7 @@ public void run(Reactor session) throws Exception {
605605

606606
// schedule execution of initializing plugins
607607
for (final PluginWrapper p : activePlugins.toArray(new PluginWrapper[0])) {
608-
g.followedBy().notFatal().attains(PLUGINS_STARTED).add("Initializing plugin " + p.getShortName(), session2 -> {
608+
g.followedBy().notFatal().attains(PLUGINS_STARTED).add("Initializing plugin " + p.getShortName(), reactor -> {
609609
if (!activePlugins.contains(p)) {
610610
return;
611611
}

core/src/main/java/hudson/PluginWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,12 +881,12 @@ private Set<String> dependentsToCheck(PluginDisableStrategy strategy) {
881881
Set<String> dependentsToCheck = switch (strategy) {
882882
case ALL ->
883883
// getDependents returns all the dependent plugins, mandatory or optional.
884-
this.getDependents();
884+
this.getDependents();
885885
default ->
886886
// It includes MANDATORY, NONE:
887887
// with NONE, the process only fail if mandatory dependent plugins exists
888888
// As of getDependents has all the dependents, we get the difference between them and only the optionals
889-
Sets.difference(this.getDependents(), this.getOptionalDependents());
889+
Sets.difference(this.getDependents(), this.getOptionalDependents());
890890
};
891891
return dependentsToCheck;
892892
}

core/src/main/java/hudson/TcpSlaveAgentListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ public void shutdown() {
229229

230230
private final class ConnectionHandler extends Thread {
231231
private static final String DEFAULT_RESPONSE_404 = """
232-
HTTP/1.0 404 Not Found\r
233-
Content-Type: text/plain;charset=UTF-8\r
234-
\r
235-
Not Found\r
232+
HTTP/1.0 404 Not Found
233+
Content-Type: text/plain;charset=UTF-8
234+
235+
Not Found
236236
""";
237237
private final Socket s;
238238
/**

core/src/main/java/hudson/cli/BuildCommand.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,18 @@ protected int run() throws Exception {
223223
protected void printUsageSummary(PrintStream stderr) {
224224
stderr.println(
225225
"""
226-
Starts a build, and optionally waits for a completion.
227-
Aside from general scripting use, this command can be
228-
used to invoke another job from within a build of one job.
229-
With the -s option, this command changes the exit code based on
230-
the outcome of the build (exit code 0 indicates a success)
231-
and interrupting the command will interrupt the job.
232-
With the -f option, this command changes the exit code based on
233-
the outcome of the build (exit code 0 indicates a success)
234-
however, unlike -s, interrupting the command will not interrupt
235-
the job (exit code 125 indicates the command was interrupted).
236-
With the -c option, a build will only run if there has been
237-
an SCM change."""
226+
Starts a build, and optionally waits for a completion.
227+
Aside from general scripting use, this command can be
228+
used to invoke another job from within a build of one job.
229+
With the -s option, this command changes the exit code based on
230+
the outcome of the build (exit code 0 indicates a success)
231+
and interrupting the command will interrupt the job.
232+
With the -f option, this command changes the exit code based on
233+
the outcome of the build (exit code 0 indicates a success)
234+
however, unlike -s, interrupting the command will not interrupt
235+
the job (exit code 125 indicates the command was interrupted).
236+
With the -c option, a build will only run if there has been
237+
an SCM change."""
238238
);
239239
}
240240

core/src/main/java/hudson/cli/DisablePluginCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class DisablePluginCommand extends CLICommand {
4747
private boolean restart;
4848

4949
@Option(name = "-strategy", aliases = "-s", metaVar = "strategy", usage = """
50-
How to process the dependent plugins.\s
50+
How to process the dependent plugins.
5151
- none: if a mandatory dependent plugin exists and it is enabled, the plugin cannot be disabled (default value).
5252
- mandatory: all mandatory dependent plugins are also disabled, optional dependent plugins remain enabled.
5353
- all: all dependent plugins are also disabled, no matter if its dependency is optional or mandatory.""")

core/src/main/java/hudson/console/ConsoleAnnotator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public ConsoleAnnotator annotate(T context, MarkupText text) {
113113
}
114114

115115
return switch (list.size()) {
116-
case 0 -> null; // no more annotator left
117-
case 1 -> list.getFirst(); // no point in aggregating
116+
case 0 -> null; // no more annotator left
117+
case 1 -> list.getFirst(); // no point in aggregating
118118
default -> this;
119119
};
120120
}
@@ -130,8 +130,8 @@ public String toString() {
130130
*/
131131
public static <T> ConsoleAnnotator<T> combine(Collection<? extends ConsoleAnnotator<? super T>> all) {
132132
return switch (all.size()) {
133-
case 0 -> null; // none
134-
case 1 -> cast(all.iterator().next()); // just one
133+
case 0 -> null; // none
134+
case 1 -> cast(all.iterator().next()); // just one
135135
default -> new ConsoleAnnotatorAggregator<>(all);
136136
};
137137
}

core/src/main/java/hudson/model/DownloadService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public static <T> boolean hasDuplicates(List<T> genericList, String comparator)
438438
try {
439439
field = genericList.getFirst().getClass().getDeclaredField(comparator);
440440
} catch (NoSuchFieldException e) {
441-
LOGGER.warning("comparator: " + comparator + "does not exist for " + genericList.getFirst().getClass() + ", " + e);
441+
LOGGER.warning("comparator: " + comparator + " does not exist for " + genericList.getFirst().getClass() + ", " + e);
442442
return false;
443443
}
444444
for (int i = 0; i < genericList.size(); i++) {

core/src/main/java/hudson/security/csrf/CrumbIssuer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@ public static class RestrictedApi extends Api {
276276
String text;
277277
CrumbIssuer ci = (CrumbIssuer) bean;
278278
switch (xpath) {
279-
case "/*/crumbRequestField/text()" -> // old FullDuplexHttpStream
279+
case "/*/crumbRequestField/text()" -> // old FullDuplexHttpStream
280280
text = ci.getCrumbRequestField();
281-
case "/*/crumb/text()" -> // ditto
281+
case "/*/crumb/text()" -> // ditto
282282
text = ci.getCrumb();
283-
case "concat(//crumbRequestField,\":\",//crumb)" -> // new FullDuplexHttpStream; Main
283+
case "concat(//crumbRequestField,\":\",//crumb)" -> // new FullDuplexHttpStream; Main
284284
text = ci.getCrumbRequestField() + ':' + ci.getCrumb();
285285
case "concat(//crumbRequestField,'=',//crumb)" -> {
286286
if (ci.getCrumbRequestField().startsWith(".") || ci.getCrumbRequestField().contains("-")) {

core/src/main/java/hudson/util/ArgumentListBuilder.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, Str
247247
* @see <a href="https://issues.jenkins.io/browse/JENKINS-10539">JENKINS-10539</a>
248248
*/
249249
private static VariableResolver<String> propertiesGeneratingResolver(final VariableResolver<String> original) {
250-
251250
return name -> {
252251
final String value = original.resolve(name);
253252
if (value == null) return null;

0 commit comments

Comments
 (0)