Skip to content

Cleaned up some duplication#38

Merged
jpd236 merged 4 commits intogoogle:masterfrom
SamuelYvon:master
Jun 5, 2017
Merged

Cleaned up some duplication#38
jpd236 merged 4 commits intogoogle:masterfrom
SamuelYvon:master

Conversation

@SamuelYvon
Copy link
Copy Markdown
Contributor

The legacy method was doing the exact same thing as addIfBodyExists. Now merged the two and added an override to support the different source of byte stream. Also formatted the file.

The legacy method was doing the exact same thing as addIfBodyExists. Now merged the two and added an override to support the different source of byte stream
@googlebot
Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@SamuelYvon
Copy link
Copy Markdown
Contributor Author

I signed it!


/**
* @param urlRewriter Rewriter to use for request URLs
* @param urlRewriter Rewriter to use for request URLs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd prefer if you revert the formatting changes for now. This format doesn't match what I think we'd be likely to use in the future (google-java-format), and I'd rather handle that in a more coordinated matter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes a lot of sense! I was unaware of the google java format


private static void addBodyIfExists(HttpURLConnection connection, Request<?> request, byte[] body)
throws IOException, AuthFailureError {
if (body != null) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

both the callers already check that body != null, so either remove this check here and rename this method "addBody" (my preference), or remove the checks above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I will commit the changes when I'm done work!

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@jpd236 jpd236 merged commit f52e1e0 into google:master Jun 5, 2017
@jpd236
Copy link
Copy Markdown
Collaborator

jpd236 commented Jun 5, 2017

Thanks for the cleanup. I tweaked your change a bit to revert some extraneous formatting changes and fix the indenting on the new function, but otherwise it looks good.

@SamuelYvon
Copy link
Copy Markdown
Contributor Author

Sorry for the leftover formatting, I noticed it this morning but I did not wanted to fix it until I was done work. FYI the google java format formatter for intellij/android studio keeps that formatting. I don't know if this is a bug with the formatter or it was just not implemented yet, thought I would let you know.

@jpd236
Copy link
Copy Markdown
Collaborator

jpd236 commented Jun 5, 2017

We haven't yet done a pass of the codebase under google-java-format or made it part of the contribution process. That's being tracked in #1. Until then, I'd just say to try and keep things as consistent with what's there as possible while minimizing extraneous changes. Thanks again.

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.

3 participants