Skip to content

Commit d3fd246

Browse files
committed
Fix formating
1 parent 25a8378 commit d3fd246

File tree

1 file changed

+35
-38
lines changed
  • util/src/main/java/io/kubernetes/client

1 file changed

+35
-38
lines changed

util/src/main/java/io/kubernetes/client/Exec.java

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.InputStream;
2020
import java.io.OutputStream;
2121
import java.util.concurrent.TimeUnit;
22-
2322
import org.apache.commons.lang3.StringUtils;
2423

2524
public class Exec {
@@ -185,42 +184,42 @@ private static class ExecProcess extends Process {
185184

186185
public ExecProcess() throws IOException {
187186
this.statusCode = -1;
188-
this.streamHandler = new WebSocketStreamHandler() {
189-
@Override
190-
public void close() {
191-
if (statusCode == -1) {
192-
InputStream inputStream = getInputStream(3);
193-
int exitCode = 0;
194-
try {
195-
int available = inputStream.available();
196-
if (available > 0) {
197-
byte[] b = new byte[available];
198-
inputStream.read(b);
199-
String result = new String(b, "UTF-8");
200-
int idx = result.lastIndexOf(':');
201-
if (idx > 0) {
202-
try {
203-
exitCode = Integer.parseInt(result.substring(idx + 1).trim());
204-
} catch (NumberFormatException nfe) {
205-
// no-op
187+
this.streamHandler =
188+
new WebSocketStreamHandler() {
189+
@Override
190+
public void close() {
191+
if (statusCode == -1) {
192+
InputStream inputStream = getInputStream(3);
193+
int exitCode = 0;
194+
try {
195+
int available = inputStream.available();
196+
if (available > 0) {
197+
byte[] b = new byte[available];
198+
inputStream.read(b);
199+
String result = new String(b, "UTF-8");
200+
int idx = result.lastIndexOf(':');
201+
if (idx > 0) {
202+
try {
203+
exitCode = Integer.parseInt(result.substring(idx + 1).trim());
204+
} catch (NumberFormatException nfe) {
205+
// no-op
206+
}
207+
}
206208
}
209+
} catch (IOException e) {
210+
}
211+
212+
// notify of process completion
213+
synchronized (ExecProcess.this) {
214+
statusCode = exitCode;
215+
ExecProcess.this.notifyAll();
207216
}
208217
}
209-
} catch (IOException e) {
210-
}
211-
212-
// notify of process completion
213-
synchronized (ExecProcess.this) {
214-
statusCode = exitCode;
215-
ExecProcess.this.notifyAll();
218+
super.close();
216219
}
217-
}
218-
super.close();
219-
}
220-
221-
};
220+
};
222221
}
223-
222+
224223
private WebSocketStreamHandler getHandler() {
225224
return streamHandler;
226225
}
@@ -247,20 +246,18 @@ public int waitFor() throws InterruptedException {
247246
}
248247
return statusCode;
249248
}
250-
249+
251250
@Override
252-
public boolean waitFor(long timeout, TimeUnit unit)
253-
throws InterruptedException {
251+
public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException {
254252
synchronized (this) {
255253
this.wait(TimeUnit.MILLISECONDS.convert(timeout, unit));
256254
}
257255
return !isAlive();
258256
}
259-
257+
260258
@Override
261259
public int exitValue() {
262-
if (statusCode == -1)
263-
throw new IllegalThreadStateException();
260+
if (statusCode == -1) throw new IllegalThreadStateException();
264261
return statusCode;
265262
}
266263

0 commit comments

Comments
 (0)