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

[FIXED JENKINS-19764] Ensure parent dir of new builds dir exists. #1377

Merged
merged 1 commit into from
Sep 5, 2014

Conversation

daniel-beck
Copy link
Member

No description provided.

@@ -619,6 +619,9 @@ public void renameTo(String newName) throws IOException {
super.renameTo(newName);
File newBuildDir = getBuildDir();
if (oldBuildDir.isDirectory() && !newBuildDir.isDirectory()) {
if (!newBuildDir.getParentFile().isDirectory()) {
newBuildDir.getParentFile().mkdirs();
Copy link
Member

Choose a reason for hiding this comment

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

It makes sense to check mkdirs() result as well. According to Javadoc, it returns "true if and only if the directory was created, along with all necessary parent directories; false otherwise", Its better to just call File::exists() after the call

Copy link
Member Author

Choose a reason for hiding this comment

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

@oleg-nenashev And then? What action would you take? You can't just abort a transaction here. Failing horribly on the subsequent builds dir rename doesn't seem to be that inappropriate.

@cloudbees-pull-request-builder

core » jenkins-core #1322 SUCCESS
This pull request looks good

daniel-beck added a commit that referenced this pull request Sep 5, 2014
[FIXED JENKINS-19764] Ensure parent dir of new builds dir exists.
@daniel-beck daniel-beck merged commit 9bc2f1d into jenkinsci:master Sep 5, 2014
daniel-beck added a commit that referenced this pull request Sep 5, 2014
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