mirror of https://github.com/apache/jclouds.git
cloudbridge compatibility glitch on AuthError
This commit is contained in:
parent
71869a6bb3
commit
e0a5ffbe9a
|
@ -112,7 +112,7 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
|
|||
".InUse")))
|
||||
|| (message != null && (message.indexOf("already exists") != -1 || message.indexOf("is in use") != -1)))
|
||||
exception = new IllegalStateException(message, exception);
|
||||
else if ("AuthFailure".equals(errorCode))
|
||||
else if (errorCode != null && errorCode.indexOf("AuthFailure") != -1)
|
||||
exception = new AuthorizationException(message, exception);
|
||||
else if (message != null
|
||||
&& (message.indexOf("Invalid id") != -1 || message.indexOf("Failed to bind") != -1))
|
||||
|
|
|
@ -164,6 +164,12 @@ public class ParseAWSErrorFromXmlContentTest {
|
|||
"<Error><Code>AuthFailure</Code></Error>", AuthorizationException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test400WithCloudBridgeAuthFailureSetsAuthorizationException() {
|
||||
assertCodeMakes("GET", URI.create("https://amazonaws.com/foo"), 400, "",
|
||||
"<Error><Code>Client.AuthFailure</Code></Error>", AuthorizationException.class);
|
||||
}
|
||||
|
||||
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String content,
|
||||
Class<? extends Exception> expected) {
|
||||
assertCodeMakes(method, uri, statusCode, message, "text/xml", content, expected);
|
||||
|
|
Loading…
Reference in New Issue