Skip to content

Enhance SaveGame: java.nio.file, Try-with-Resources & Improved Error Handling #2494

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

capdevon
Copy link
Contributor

@capdevon capdevon commented Jun 13, 2025

This PR focuses on enhancing the stability and maintainability of the SaveGame class. By migrating to java.nio.file (NIO.2) and utilizing try-with-resources, we gain:

  • Reduced resource leaks: Streams are now automatically closed.
  • Adoption of java.nio.file: Replaced java.io.File with Path and Files for more reliable and cross-platform file system interactions.
  • Cleaner, more readable code: Less boilerplate for stream management.
  • Better diagnostics: Enhanced logging and exception handling provide clearer insights into potential issues.

Edit:
Tested with
https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/tools/TestSaveGame.java

@yaRnMcDonuts yaRnMcDonuts added this to the v3.9.0 milestone Jun 14, 2025
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