Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public void deploy() {
LOG.debug("Skipping deployment because deployment status %s for %s is not in %s", new Object [] {status, deploymentName, COMPLETED_STATES});
return;
}
}catch(OpenShiftException e) {
if(e.getStatus() == null || e.getStatus().getCode() != IHttpConstants.STATUS_NOT_FOUND) {
} catch(OpenShiftException e) {
if (e.getStatus() == null || e.getStatus().getCode() != IHttpConstants.STATUS_NOT_FOUND) {
//swallow exception like cli
throw e;
}
Expand All @@ -82,7 +82,7 @@ private String getLatestDeploymentName() {
}

private String getStatusFor(IReplicationController rc) {
if(rc.isAnnotatedWith(IReplicationController.DEPLOYMENT_PHASE)) {
if (rc.isAnnotatedWith(IReplicationController.DEPLOYMENT_PHASE)) {
return rc.getAnnotation(IReplicationController.DEPLOYMENT_PHASE);
}
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static OpenShiftException createOpenShiftException(IClient client, Respon
AuthorizationDetails details = new AuthorizationDetails(response.headers(), link);
return new com.openshift.restclient.authorization.UnauthorizedException(details, status);
case IHttpConstants.STATUS_NOT_FOUND:
return new NotFoundException(status == null ? "Not Found" : status.getMessage());
return new NotFoundException(e, status, status == null ? "Not Found" : status.getMessage());
default:
return new OpenShiftException(e, status, "Exception trying to %s %s response code: %s", response.request().method(), response.request().url().toString(), responseCode);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/openshift/restclient/NotFoundException.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
******************************************************************************/
package com.openshift.restclient;

import com.openshift.restclient.model.IStatus;

/**
* @author jeff.cantrill
*/
Expand All @@ -28,4 +30,8 @@ public NotFoundException(String message) {
public NotFoundException(Throwable cause) {
super(cause, "");
}

public NotFoundException(Throwable cause, IStatus status, String message, Object... arguments) {
super(cause, status, message, arguments);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.mockito.runners.MockitoJUnitRunner;

import com.openshift.restclient.IClient;
import com.openshift.restclient.NotFoundException;
import com.openshift.restclient.OpenShiftException;
import com.openshift.restclient.capability.resources.IDeployCapability;
import com.openshift.restclient.http.IHttpConstants;
Expand Down Expand Up @@ -121,7 +122,7 @@ private void givenTheDeploymentIsRetrieved() {
private void givenTheLatestDeploymentIsNotFound() {
IStatus status = mock(IStatus.class);
when(status.getCode()).thenReturn(IHttpConstants.STATUS_NOT_FOUND);
OpenShiftException e = new OpenShiftException(new RuntimeException(), status, "");
NotFoundException e = new NotFoundException(null, status, "Not Found");
when(client.get(anyString(),anyString(),anyString())).thenThrow(e);
}
}