Skip to content

Commit

Permalink
Throw exception if RequestToken does not return an oauth_token
Browse files Browse the repository at this point in the history
  • Loading branch information
SidneyAllen committed Mar 21, 2018
1 parent f34187f commit 8a119fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/xero/api/OAuthGetTemporaryToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public final OAuthCredentialsResponse execute() throws IOException,XeroApiExcept
UrlEncodedParser.parse(content, oauthResponse);

int code = response.getStatusLine().getStatusCode();
if (oauthResponse.token == null) {
XeroApiException e = new XeroApiException(400,content);
throw e;
}
if (code != 200) {
XeroApiException e = new XeroApiException(code,content);
throw e;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/xero/api/XeroClientException.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class XeroClientException extends RuntimeException {
*
*/
private static final long serialVersionUID = 1L;

/**
* Create new exception.
*
Expand All @@ -31,5 +30,5 @@ public XeroClientException(String message) {
public XeroClientException(String message, Throwable cause) {
super(message, cause);
}

}

0 comments on commit 8a119fa

Please sign in to comment.