Skip to content

Conversation

@caitlinrussell
Copy link

This will be added under the "graphResponseHeaders" node in the additionalDataManager:

me.additionalDataManager().get("graphResponseHeaders");

Copy link

@akrantz akrantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this was my first code review, I felt compelled to add some feedback. The overall changes are fine. Let me know whether you want to make the suggested changes, but if you don't I would be fine with it.

}

@Override
public <T> T deserializeObject(final String inputString, final Class<T> clazz, Map<String, java.util.List<String>> responseHeaders) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that you could provide only one overload for the deserializeObject function by making the responseHeaders parameter accept the default value of null. I would favor using default parameters to minimize the overloads, and having separate overloads only when necessary. You would also need to update the interface definition to match, but I believe that would be an OK change to make.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Java doesn't support default parameters, the two simplest ideas I had were to use overloading or check for a null responseHeaders list. Since the latter requires changing the method signature across the library, I figured the former was a bit cleaner.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I mistakenly thought Java had added default parameters.


JsonObject res = new GsonBuilder().create().fromJson(jsonString.toString(), JsonObject.class);
return res.get("access_token").toString();
return res.get("access_token").toString().replaceAll("\"", "");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to add a comment that quotes are being removed.

try {
list.add(String.format("%d", connection.getResponseCode()));
} catch (IOException e) {
throw new IllegalArgumentException("Invalid connection response code: ", e);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to concatenate the error response code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By definition of this error, it can't be done (connection.getResponseCode() itself needs to be wrapped in a catch). However, the JavaDoc explains that an IllegalArgumentException is thrown when a connection cannot be made, so I added this to the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants