Skip to content

Commit 8a119fa

Browse files
committed
Throw exception if RequestToken does not return an oauth_token
1 parent f34187f commit 8a119fa

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/com/xero/api/OAuthGetTemporaryToken.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public final OAuthCredentialsResponse execute() throws IOException,XeroApiExcept
8383
UrlEncodedParser.parse(content, oauthResponse);
8484

8585
int code = response.getStatusLine().getStatusCode();
86+
if (oauthResponse.token == null) {
87+
XeroApiException e = new XeroApiException(400,content);
88+
throw e;
89+
}
8690
if (code != 200) {
8791
XeroApiException e = new XeroApiException(code,content);
8892
throw e;

src/main/java/com/xero/api/XeroClientException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class XeroClientException extends RuntimeException {
1212
*
1313
*/
1414
private static final long serialVersionUID = 1L;
15-
1615
/**
1716
* Create new exception.
1817
*
@@ -31,5 +30,5 @@ public XeroClientException(String message) {
3130
public XeroClientException(String message, Throwable cause) {
3231
super(message, cause);
3332
}
34-
33+
3534
}

0 commit comments

Comments
 (0)