Skip to content

Handle FileAlreadyExistsException in ScalaPBGenerator #787

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

Closed
wants to merge 2 commits into from

Conversation

ptarjan
Copy link
Contributor

@ptarjan ptarjan commented Jul 17, 2019

workaround for #779

@ptarjan ptarjan requested a review from johnynek as a code owner July 17, 2019 18:10
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only "I consent." in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@ptarjan
Copy link
Contributor Author

ptarjan commented Jul 17, 2019

@sholokhov can you comment I consent. in this PR please?

Copy link
Contributor

@johnynek johnynek left a comment

Choose a reason for hiding this comment

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

let's merge this workaround and take a TODO to run down the root cause.

@@ -39,7 +40,13 @@ class ScalaPBGenerator extends Processor {
val relativePath = root.relativize(fullPath)

relativePath.toFile.getParentFile.mkdirs
Files.copy(fullPath, relativePath)
Try(Files.copy(fullPath, relativePath)) match {
case Failure(err) if err.isInstanceOf[FileAlreadyExistsException] =>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: case Failure(err: FileAlreadyExistsException) => would be a bit less verbose.

case Failure(err) if err.isInstanceOf[FileAlreadyExistsException] =>
Console.println(s"File already exists, skipping: ${err.getMessage}")
case Failure(err) =>
sys.error(err.getMessage)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, I would rethrow here: throw err

@sholokhov
Copy link

I consent.

@johnynek
Copy link
Contributor

@iirina could you help us see how to satisfy the CLA bot. @ittaiz and I no longer have that power.

@ptarjan
Copy link
Contributor Author

ptarjan commented Jul 18, 2019

@johnynek given that he already said that, can I close this PR, and open a new one with me as the only author on the code as a way to satisfy that?

@johnynek johnynek closed this Jul 18, 2019
@ptarjan ptarjan deleted the pt-file-not-found branch July 18, 2019 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants