Skip to content

Commit fe649b1

Browse files
committed
Format repository with Spotless
1 parent 42201e3 commit fe649b1

File tree

257 files changed

+6905
-5151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+6905
-5151
lines changed

pom.xml

+21-21
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,6 @@ THE SOFTWARE.
133133
<version>2.16.1</version>
134134
<scope>test</scope>
135135
</dependency>
136-
<dependency>
137-
<groupId>org.junit.jupiter</groupId>
138-
<artifactId>junit-jupiter</artifactId>
139-
<scope>test</scope>
140-
</dependency>
141-
<dependency>
142-
<groupId>org.junit.jupiter</groupId>
143-
<artifactId>junit-jupiter-params</artifactId>
144-
<scope>test</scope>
145-
</dependency>
146-
<dependency>
147-
<groupId>org.junit.vintage</groupId>
148-
<artifactId>junit-vintage-engine</artifactId>
149-
<scope>test</scope>
150-
</dependency>
151136
<dependency>
152137
<groupId>org.bouncycastle</groupId>
153138
<artifactId>bcpkix-jdk18on</artifactId>
@@ -170,6 +155,21 @@ THE SOFTWARE.
170155
<artifactId>test-annotations</artifactId>
171156
<scope>test</scope>
172157
</dependency>
158+
<dependency>
159+
<groupId>org.junit.jupiter</groupId>
160+
<artifactId>junit-jupiter</artifactId>
161+
<scope>test</scope>
162+
</dependency>
163+
<dependency>
164+
<groupId>org.junit.jupiter</groupId>
165+
<artifactId>junit-jupiter-params</artifactId>
166+
<scope>test</scope>
167+
</dependency>
168+
<dependency>
169+
<groupId>org.junit.vintage</groupId>
170+
<artifactId>junit-vintage-engine</artifactId>
171+
<scope>test</scope>
172+
</dependency>
173173
<dependency>
174174
<groupId>org.mockito</groupId>
175175
<artifactId>mockito-core</artifactId>
@@ -333,7 +333,8 @@ THE SOFTWARE.
333333
<descriptor>src/assembly/agent-load-test.xml</descriptor>
334334
</descriptors>
335335
<attach>false</attach>
336-
<tarLongFileMode>posix</tarLongFileMode> <!-- https://maven.apache.org/plugins/maven-assembly-plugin/faq.html#tarFileModes -->
336+
<tarLongFileMode>posix</tarLongFileMode>
337+
<!-- https://maven.apache.org/plugins/maven-assembly-plugin/faq.html#tarFileModes -->
337338
</configuration>
338339
<executions>
339340
<execution>
@@ -347,7 +348,8 @@ THE SOFTWARE.
347348
</execution>
348349
</executions>
349350
</plugin>
350-
<plugin> <!-- TODO probably superseded by Incrementals? -->
351+
<plugin>
352+
<!-- TODO probably superseded by Incrementals? -->
351353
<groupId>org.codehaus.mojo</groupId>
352354
<artifactId>build-helper-maven-plugin</artifactId>
353355
<executions>
@@ -396,11 +398,9 @@ THE SOFTWARE.
396398
<rerunFailingTestsCount>4</rerunFailingTestsCount>
397399
<properties>
398400
<!-- https://junit.org/junit5/docs/snapshot/user-guide/#writing-tests-declarative-timeouts -->
399-
<configurationParameters>
400-
junit.jupiter.execution.timeout.default=15s
401+
<configurationParameters>junit.jupiter.execution.timeout.default=15s
401402
junit.jupiter.execution.timeout.mode=disabled_on_debug
402-
junit.jupiter.execution.timeout.thread.mode.default=SEPARATE_THREAD
403-
</configurationParameters>
403+
junit.jupiter.execution.timeout.thread.mode.default=SEPARATE_THREAD</configurationParameters>
404404
</properties>
405405
</configuration>
406406
</plugin>

src/main/java/hudson/remoting/AbstractByteBufferCommandTransport.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ public abstract class AbstractByteBufferCommandTransport extends CommandTranspor
6969
* Our channel.
7070
*/
7171
private Channel channel;
72+
7273
@Deprecated
7374
private final ByteBuffer writeChunkHeader;
7475
/**
7576
* The transport frame size.
7677
*/
7778
private int transportFrameSize = 8192;
79+
7880
@Deprecated
7981
private ByteBuffer writeChunkBody;
8082
/**
@@ -354,5 +356,4 @@ public final void write(Command cmd, boolean last) throws IOException {
354356
public void terminate(IOException e) {
355357
receiver.terminate(e);
356358
}
357-
358359
}

src/main/java/hudson/remoting/AsyncFutureImpl.java

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
22
* The MIT License
3-
*
3+
*
44
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, CloudBees, Inc.
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights
99
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010
* copies of the Software, and to permit persons to whom the Software is
1111
* furnished to do so, subject to the following conditions:
12-
*
12+
*
1313
* The above copyright notice and this permission notice shall be included in
1414
* all copies or substantial portions of the Software.
15-
*
15+
*
1616
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -33,7 +33,7 @@
3333
* {@link Future} implementation whose computation is carried out elsewhere.
3434
*
3535
* Call the {@link #set(Object)} method or {@link #set(Throwable)} method to set the value to the future.
36-
*
36+
*
3737
* @author Kohsuke Kawaguchi
3838
*/
3939
public class AsyncFutureImpl<V> implements Future<V> {
@@ -50,9 +50,11 @@ public class AsyncFutureImpl<V> implements Future<V> {
5050
private boolean cancelled;
5151

5252
public AsyncFutureImpl() {}
53+
5354
public AsyncFutureImpl(V value) {
5455
set(value);
5556
}
57+
5658
public AsyncFutureImpl(Throwable value) {
5759
set(value);
5860
}
@@ -74,18 +76,22 @@ public synchronized boolean isDone() {
7476

7577
@Override
7678
public synchronized V get() throws InterruptedException, ExecutionException {
77-
while(!completed)
79+
while (!completed) {
7880
wait();
79-
if(problem!=null)
81+
}
82+
if (problem != null) {
8083
throw new ExecutionException(problem);
81-
if(cancelled)
84+
}
85+
if (cancelled) {
8286
throw new CancellationException();
87+
}
8388
return value;
8489
}
8590

8691
@Override
8792
@CheckForNull
88-
public synchronized V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
93+
public synchronized V get(long timeout, TimeUnit unit)
94+
throws InterruptedException, ExecutionException, TimeoutException {
8995
// The accuracy of wait(long) operation is milliseconds anyway, but ok.
9096
long endWaitTime = System.nanoTime() + unit.toNanos(timeout);
9197
while (!completed) {
@@ -94,15 +100,17 @@ public synchronized V get(long timeout, TimeUnit unit) throws InterruptedExcepti
94100
break;
95101
}
96102

97-
wait(timeToWait / 1000000, (int)(timeToWait % 1000000));
103+
wait(timeToWait / 1000000, (int) (timeToWait % 1000000));
98104
}
99105

100-
if(!completed)
106+
if (!completed) {
101107
throw new TimeoutException();
102-
if(cancelled)
108+
}
109+
if (cancelled) {
103110
throw new CancellationException();
111+
}
104112

105-
//TODO: we may be calling a complex get() implementation in the override, which may hang the code
113+
// TODO: we may be calling a complex get() implementation in the override, which may hang the code
106114
// The only missing behavior is "problem!=null" branch, but probably we cannot just replace the code without
107115
// an override issue risk.
108116
return get();

src/main/java/hudson/remoting/Asynchronous.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,4 @@
3939
@Documented
4040
@Target(ElementType.METHOD)
4141
@Retention(RetentionPolicy.RUNTIME)
42-
public @interface Asynchronous {
43-
}
42+
public @interface Asynchronous {}

src/main/java/hudson/remoting/AtmostOneThreadExecutor.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ public AtmostOneThreadExecutor() {
4444
public void shutdown() {
4545
synchronized (q) {
4646
shutdown = true;
47-
if (isAlive())
47+
if (isAlive()) {
4848
worker.interrupt();
49+
}
4950
}
5051
}
5152

5253
/**
5354
* Do we have a worker thread and is it running?
5455
*/
5556
private boolean isAlive() {
56-
return worker!=null && worker.isAlive();
57+
return worker != null && worker.isAlive();
5758
}
5859

5960
@NonNull
@@ -111,7 +112,7 @@ public void run() {
111112
while (true) {
112113
Runnable task;
113114
synchronized (q) {
114-
if (q.isEmpty()) {// no more work
115+
if (q.isEmpty()) { // no more work
115116
worker = null;
116117
return;
117118
}

src/main/java/hudson/remoting/Base64.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* @deprecated Use {@link java.util.Base64} instead
3838
*/
3939
@Deprecated
40-
public final class Base64 {
40+
public final class Base64 {
4141

4242
/**
4343
* Encodes hex octets into Base64
@@ -48,8 +48,9 @@ public final class Base64 {
4848
@Nullable
4949
public static String encode(byte[] binaryData) {
5050

51-
if (binaryData == null)
51+
if (binaryData == null) {
5252
return null;
53+
}
5354

5455
return java.util.Base64.getEncoder().encodeToString(binaryData);
5556
}
@@ -61,12 +62,14 @@ public static String encode(byte[] binaryData) {
6162
* @return Array containing decoded data. {@code null} if the data cannot be decoded.
6263
*/
6364
@CheckForNull
64-
@SuppressFBWarnings(value = "PZLA_PREFER_ZERO_LENGTH_ARRAYS",
65+
@SuppressFBWarnings(
66+
value = "PZLA_PREFER_ZERO_LENGTH_ARRAYS",
6567
justification = "Null arrays are the part of the library API")
6668
public static byte[] decode(String encoded) {
6769

68-
if (encoded == null)
70+
if (encoded == null) {
6971
return null;
72+
}
7073

7174
return java.util.Base64.getDecoder().decode(encoded);
7275
}

0 commit comments

Comments
 (0)