Skip to content

Commit

Permalink
Refactoring multi-catch blocks and the InterruptedExceptions, Executi…
Browse files Browse the repository at this point in the history
…onException, IOException in the BaseOperation.java
  • Loading branch information
Shivkumar13 committed Aug 26, 2020
1 parent 543d431 commit 793f5dd
Showing 1 changed file with 1 addition and 45 deletions.
Expand Up @@ -177,9 +177,6 @@ private L listRequestHelper(URL url) {
throw KubernetesClientException.launderThrowable(forOperationType("list"), e);
}

// catch (InterruptedException | ExecutionException | IOException e) {
// throw KubernetesClientException.launderThrowable(forOperationType("list"), e);
// }

}

Expand Down Expand Up @@ -243,34 +240,14 @@ public T getMandatory() {
try {
URL requestUrl = getCompleteResourceUrl();
return handleGet(requestUrl);
} catch (KubernetesClientException e) {
throw KubernetesClientException.launderThrowable(forOperationType("get"), e);
//if (e.getCode() != HttpURLConnection.HTTP_NOT_FOUND) {
// throw e;
//} else {
// String resourceType = type != null ? type.getSimpleName() : "Resource";
// String msg = resourceType + " with name: [" + getName() + "] not found in namespace: [" + (Utils.isNotNullOrEmpty(getNamespace()) ? getName() : getConfig().getNamespace()) + "]";
<<<<<<< HEAD
// throw new KubernetesClientException(msg, HttpURLConnection.HTTP_NOT_FOUND, new StatusBuilder().withCode(HttpURLConnection.HTTP_NOT_FOUND).withMessage(msg).build());
// }
} catch (InterruptedException | ExecutionException | IOException e) {
=======
// throw new KubernetesClientException(msg, HttpURLConnection.HTTP_NOT_FOUND, new StatusBuilder().withCode(HttpURLConnection.HTTP_NOT_FOUND).withMessage(msg).build());
// }
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(forOperationType("get"), ie);
} catch (ExecutionException | IOException e) {
>>>>>>> ed84e0375... Refactoring multi-catch blocks, and the InterruptedExceptions, ExecutionException, IOException in the BaseOperation.java
throw KubernetesClientException.launderThrowable(forOperationType("get"), e);
}
}

//catch (InterruptedException | ExecutionException | IOException e) {
//throw KubernetesClientException.launderThrowable(forOperationType("get"), e);
//}


public RootPaths getRootPaths() {
try {
URL requestUrl = new URL(config.getMasterUrl());
Expand All @@ -281,17 +258,12 @@ public RootPaths getRootPaths() {
throw e;
}
return null;
} catch (InterruptedException ie) {
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw KubernetesClientException.launderThrowable(ie);
} catch (ExecutionException | IOException e) {
throw KubernetesClientException.launderThrowable(e);
}


// catch (InterruptedException | ExecutionException | IOException e) {
//throw KubernetesClientException.launderThrowable(e);
//}
}

@Override
Expand Down Expand Up @@ -381,9 +353,6 @@ public T create(T... resources) throws KubernetesClientException {
throw KubernetesClientException.launderThrowable(forOperationType("create"), e);
}

// catch (InterruptedException | ExecutionException | IOException e) {
// throw KubernetesClientException.launderThrowable(forOperationType("create"), e);
// }
}

@Override
Expand All @@ -401,9 +370,6 @@ public T create(T resource) {
throw KubernetesClientException.launderThrowable(forOperationType("create"), e);
}

// catch (InterruptedException | ExecutionException | IOException e) {
// throw KubernetesClientException.launderThrowable(forOperationType("create"), e);
// }
}

@Override
Expand Down Expand Up @@ -795,10 +761,6 @@ public T updateStatus(T item) {
throw KubernetesClientException.launderThrowable(forOperationType("statusUpdate"), e);
}


// catch (InterruptedException | ExecutionException | IOException e) {
// throw KubernetesClientException.launderThrowable(forOperationType("statusUpdate"), e);
// }
}

public BaseOperation<T, L, D, R> withItem(T item) {
Expand Down Expand Up @@ -955,9 +917,6 @@ protected Scale handleScale(Scale scaleParam) {
throw KubernetesClientException.launderThrowable(forOperationType("scale"), e);
}

// catch (InterruptedException | ExecutionException | IOException e) {
// throw KubernetesClientException.launderThrowable(forOperationType("scale"), e);
// }
}

protected Status handleDeploymentRollback(DeploymentRollback deploymentRollback) {
Expand All @@ -970,9 +929,6 @@ protected Status handleDeploymentRollback(DeploymentRollback deploymentRollback)
throw KubernetesClientException.launderThrowable(forOperationType("rollback"), e);
}

// catch (InterruptedException | ExecutionException | IOException e) {
// throw KubernetesClientException.launderThrowable(forOperationType("rollback"), e);
// }
}

protected T handleGet(URL resourceUrl) throws InterruptedException, ExecutionException, IOException {
Expand Down

0 comments on commit 793f5dd

Please sign in to comment.