You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oltu.apache.org by "Nadia Guerras (JIRA)" <ji...@apache.org> on 2017/07/04 06:54:00 UTC

[jira] [Created] (OLTU-207) Error in responseCode

Nadia Guerras created OLTU-207:
----------------------------------

             Summary: Error in responseCode
                 Key: OLTU-207
                 URL: https://issues.apache.org/jira/browse/OLTU-207
             Project: Apache Oltu
          Issue Type: Bug
          Components: oauth2-client
    Affects Versions: oauth2-1.0.2
            Reporter: Nadia Guerras


I'm using the api and I am having problems with responseCode in URLConnectionClient, 

        if ((responseCode == 400) || (responseCode == 401))
          inputStream = httpURLConnection.getErrorStream();
        else {
          inputStream = httpURLConnection.getInputStream();
        }

If responseCode=500 then I have to use httpURLConnection.getErrorStream();

Can we use something like this:?

if (httpConn.getResponseCode() >= 400) {
    _is = httpConn.getInputStream();
} else {
     /* error from server */
    _is = httpConn.getErrorStream();
}


There are other frameworks that ask if httpConn.getErrorStream()!=null.





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)