-
Notifications
You must be signed in to change notification settings - Fork 116
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
fix(utils): Improve robustness in createFolder #1619
Merged
mickaelistria
merged 2 commits into
eclipse-m2e:master
from
rbioteau:fix/create_folder_race_condition
Jan 9, 2024
Merged
fix(utils): Improve robustness in createFolder #1619
mickaelistria
merged 2 commits into
eclipse-m2e:master
from
rbioteau:fix/create_folder_race_condition
Jan 9, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/M2EUtils.java
Outdated
Show resolved
Hide resolved
The `createFolder` util method should not throw an Exception when the folder already exists. A first step toward this behavior has been added with eclipse-m2e@00ca0df It looks however incomplete as I have a case in my integration of me where an ResourceException is thrown like below: ``` org.eclipse.core.internal.resources.ResourceException(/procurement-app/target)[374]: java.lang.Exception: Resource '/procurement-app/target' already exists. at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42) at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38) at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:346) at org.eclipse.core.internal.resources.Resource.checkDoesNotExist(Resource.java:333) at org.eclipse.core.internal.resources.Folder.assertCreateRequirements(Folder.java:40) at org.eclipse.core.internal.resources.Folder.create(Folder.java:101) at org.eclipse.core.internal.resources.Folder.create(Folder.java:129) at org.eclipse.m2e.core.internal.M2EUtils.createFolder(M2EUtils.java:61) at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:87) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$6(ProjectConfigurationManager.java:504) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:498) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.configureNewMavenProjects(ProjectConfigurationManager.java:279) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$1(ProjectConfigurationManager.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:139) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:130) ``` `374` is the code status for `PATH_OCCUPIED` which is used [here](https://github.com/eclipse-platform/eclipse.platform/blob/master/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java#L345) Also ignoring this status should improve robustness. Signed-off-by: Romain Bioteau <romain.bioteau@bonitasoft.com>
…s.java Co-authored-by: Mickael Istria <mistria@redhat.com>
mickaelistria
force-pushed
the
fix/create_folder_race_condition
branch
from
January 8, 2024 16:17
84207b0
to
624cc53
Compare
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
createFolder
util method should not throw an Exception when the folder already exists.A first step toward this behavior has been added with 00ca0df
It looks however incomplete as I have a case in my integration of me where an ResourceException is thrown like below:
374
is the code status forPATH_OCCUPIED
which is used hereAlso ignoring this status should improve robustness.