mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 15:08:28 +00:00
Merge pull request #151 from andreisavu/illegal-state-on-firewall-auth
Throw an IllegalStateException on firewall authorization failure
This commit is contained in:
commit
2f21049cbd
@ -77,6 +77,9 @@ public class CloudStackErrorHandler implements HttpErrorHandler {
|
|||||||
exception = new IllegalStateException(message, exception);
|
exception = new IllegalStateException(message, exception);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 537:
|
||||||
|
exception = new IllegalStateException(message, exception);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (response.getPayload() != null)
|
if (response.getPayload() != null)
|
||||||
|
@ -91,6 +91,16 @@ public class CloudStackErrorHandlerTest {
|
|||||||
assertCodeMakes("GET", URI.create("https://cloudstack.com/foo"), 409, "", "Conflict", IllegalStateException.class);
|
assertCodeMakes("GET", URI.create("https://cloudstack.com/foo"), 409, "", "Conflict", IllegalStateException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test void test537MakesIllegalStateException() {
|
||||||
|
assertCodeMakes(
|
||||||
|
"GET",
|
||||||
|
URI.create("http://10.26.26.155:8080/client/api?response=json&command=createIpForwardingRule&ipaddressid=37&startport=22&protocol=tcp"),
|
||||||
|
537,
|
||||||
|
"",
|
||||||
|
"{ \"createipforwardingruleresponse\" : {\"errorcode\" : 537, \"errortext\" : \"There is already firewall rule specified for the ip address id=37\"} }",
|
||||||
|
IllegalStateException.class);
|
||||||
|
}
|
||||||
|
|
||||||
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
|
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
|
||||||
Class<? extends Exception> expected) {
|
Class<? extends Exception> expected) {
|
||||||
assertCodeMakes(method, uri, statusCode, message, "text/xml", content, expected);
|
assertCodeMakes(method, uri, statusCode, message, "text/xml", content, expected);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user