Skip to content

Commit

Permalink
addressing code smells and re-enabling the token test
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Nov 3, 2021
1 parent 5e78d42 commit 0d0b45d
Show file tree
Hide file tree
Showing 31 changed files with 102 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public interface ExecListener {
/**
* Called when the request has successfully been upgraded to a web socket.
*/
default void onOpen() {};
default void onOpen() {}

/**
* Called when the transport or protocol layer of this web socket errors during communication.
*
* @param t Throwable
*/
default void onFailure(Throwable t) {};
default void onFailure(Throwable t) {}

/**
* Called when the server sends a close message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
Expand Down Expand Up @@ -134,7 +133,7 @@ private L listRequestHelper(URL url) {
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType("list"), ie);
} catch (ExecutionException | IOException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("list"), e);
}
}
Expand Down Expand Up @@ -183,7 +182,7 @@ public T getMandatory() {
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType("get"), ie);
} catch (ExecutionException | IOException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("get"), e);
}
}
Expand Down Expand Up @@ -503,7 +502,7 @@ public T updateStatus(T item) {
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType("statusUpdate"), ie);
} catch (ExecutionException | IOException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("statusUpdate"), e);
}

Expand Down Expand Up @@ -632,27 +631,27 @@ public boolean isResourceNamespaced() {
return Utils.isResourceNamespaced(getType());
}

protected T handleResponse(HttpRequest.Builder requestBuilder) throws ExecutionException, InterruptedException, IOException {
protected T handleResponse(HttpRequest.Builder requestBuilder) throws InterruptedException, IOException {
return handleResponse(requestBuilder, getType());
}

@Override
protected T handleCreate(T resource) throws ExecutionException, InterruptedException, IOException {
protected T handleCreate(T resource) throws InterruptedException, IOException {
updateApiVersion(resource);
return handleCreate(resource, getType());
}

protected T handleUpdate(T updated, boolean status) throws ExecutionException, InterruptedException, IOException {
protected T handleUpdate(T updated, boolean status) throws InterruptedException, IOException {
updateApiVersion(updated);
return handleUpdate(updated, getType(), status);
}

protected T handlePatch(PatchContext context, T current, T updated, boolean status) throws ExecutionException, InterruptedException, IOException {
protected T handlePatch(PatchContext context, T current, T updated, boolean status) throws InterruptedException, IOException {
updateApiVersion(updated);
return handlePatch(context, current, updated, getType(), status);
}

protected T handlePatch(T current, Map<String, Object> patchedUpdate) throws ExecutionException, InterruptedException, IOException {
protected T handlePatch(T current, Map<String, Object> patchedUpdate) throws InterruptedException, IOException {
updateApiVersion(current);
return handlePatch(current, patchedUpdate, getType());
}
Expand All @@ -663,7 +662,7 @@ protected T sendPatchedObject(T oldObject, T updatedObject) {
} catch (InterruptedException interruptedException) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(interruptedException);
} catch (ExecutionException | IOException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(e);
}
}
Expand All @@ -674,7 +673,7 @@ protected Scale handleScale(Scale scaleParam) {
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType("scale"), ie);
} catch (ExecutionException | IOException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("scale"), e);
}

Expand All @@ -686,13 +685,13 @@ protected Status handleDeploymentRollback(DeploymentRollback deploymentRollback)
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType("rollback"), ie);
} catch (ExecutionException | IOException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("rollback"), e);
}

}

protected T handleGet(URL resourceUrl) throws InterruptedException, ExecutionException, IOException {
protected T handleGet(URL resourceUrl) throws InterruptedException, IOException {
T answer = handleGet(resourceUrl, getType());
updateApiVersion(answer);
return answer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.fabric8.kubernetes.client.utils.Utils;

import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Supplier;
Expand Down Expand Up @@ -265,7 +264,7 @@ public T patch(PatchContext patchContext, String patch) {
} catch (InterruptedException interruptedException) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType(PATCH_OPERATION), interruptedException);
} catch (IOException | ExecutionException e) {
} catch (IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType(PATCH_OPERATION), e);
}
}
Expand Down
Loading

0 comments on commit 0d0b45d

Please sign in to comment.