Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use try-with-resources #432

Merged
merged 1 commit into from
May 2, 2017
Merged

Conversation

runningcode
Copy link
Contributor

No description provided.

Copy link
Contributor

@kageiit kageiit left a comment

Choose a reason for hiding this comment

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

Why did the wrapper jar change?

@runningcode runningcode force-pushed the no/try-with-resources branch from 8f04b59 to 7f43b0a Compare April 26, 2017 18:16
@runningcode
Copy link
Contributor Author

Not sure why the wrapper changed, thanks for catching that.

@kageiit
Copy link
Contributor

kageiit commented Apr 26, 2017

Seems like travis ci is broken. Can you check the failures?

@runningcode runningcode force-pushed the no/try-with-resources branch 3 times, most recently from 2ea6cdc to 43b46b2 Compare April 28, 2017 04:03
@runningcode runningcode force-pushed the no/try-with-resources branch from 43b46b2 to becff1c Compare April 28, 2017 04:04
@runningcode
Copy link
Contributor Author

Ok! CI passes! :)

TemplateReader replacingReader = new TemplateReader(reader, new TemplateMapResolver(templates));

OutputStream outputStream = new FileOutputStream(destination);
destination.getParentFile().mkdirs();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the directory creation inside the try?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same thing here new FileOutputStream(destination) depends on this file having been created.

InputStream inputStream = FileUtil.class.getResourceAsStream(resource);
destination.getParentFile().mkdirs();
OutputStream outputStream = new FileOutputStream(destination);
destination.getParentFile().mkdirs();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the directory creation inside the try?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it can't. This was why this PR was originally failing on ci. The next line, new FileOutputStream(destination) depends on this file having been created.
Luckily, this method doesn't throw an IOException.

@kageiit kageiit merged commit b686859 into uber:master May 2, 2017
@runningcode runningcode deleted the no/try-with-resources branch May 2, 2017 02:28
cwoodwar6 pushed a commit to cwoodwar6/okbuck that referenced this pull request May 10, 2017
* uber/master:
  Use stream instead of parallelStream (uber#437)
  Add empty resource rule if using resource union. (uber#438)
  Publich v0.20.7
  Move okbuck task to its own gradle task class. (uber#436)
  Use try-with-resources (uber#432)
  Update README.md
  Do not allow okbuck to be run without okbuck.wrapper set to true. (uber#433)
  Set descriptions in tasks class instead of when creating them. (uber#431)
  Move cleaning the .okbuck/gen folder to the first step of setupOkbuck. (uber#430)
  Publish v0.20.6
  Add support for downloading 22-25 API robolectric runtime dependencies. (uber#427)
  Skip okbuck if we just want to kill the buck daemon. (uber#425)
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.

2 participants