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

Fixes FileSystemException #3281

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EdoardoP92
Copy link
Contributor

image

Under Windows operating system, unfortunately, I'm unable to build the JPA project because of a FileSystemException thrown at the act of delete the test-eclipselink-meta.log file in the EclipseLinkMetaAnnotatedQueryMethodIntegrationTests class. The proposal is to use a temporary file whose life cycle can be easily managed by the underlying operating system. Thanks in advance to the JPA team.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 20, 2023
Comment on lines 82 to 83
Path logFile = Files.createTempFile("test-eclipselink-meta", ".log");
LOG_FILE = logFile.toAbsolutePath().toString();
Copy link
Member

Choose a reason for hiding this comment

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

how about making use of junits @TempDir leveraging automatic cleanup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, thank you for the reply. Unfortunately with @TempDir there is the same problem...

@TempDir
static Path TMP;

    @BeforeAll
    static void createLogfile() throws IOException {
        Path logFile = TMP.resolve("test-eclipselink-meta.log");
        LOG_FILE = logFile.toAbsolutePath().toString();
    }

image

Copy link
Member

Choose a reason for hiding this comment

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

Generally switching to @TempDir is generally a good thing but we cannot fix the underlying problem that Eclipselink doesn't close the underlying logger. The offending code is in EntityManagerSetupImpl.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mp911de Let me know how I can resolve this issue, if my proposal to use temporary files is ok or if you prefer some other changes. I want to contribute, but I can't check my contribution without run the entire test suite. In the meantime, after further analysis, I can for sure open an issue, or a PR to the EclipseLink project. Thank you very much.

Copy link
Member

Choose a reason for hiding this comment

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

Fixing the problem for you leaves us with temp directories that aren't cleaned up. So I think you could explore File.deleteOnExit().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mp911de Added with the latest commit. Thanks!

@christophstrobl
Copy link
Member

thank you @EdoardoP92 for bringing this up and taking the time to create a PR.

@EdoardoP92
Copy link
Contributor Author

thank you @EdoardoP92 for bringing this up and taking the time to create a PR.

@christophstrobl thank you too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants