Hello, I am having a strange issue working with the Configurate library in Sponge. Sometimes when trying to save a file, I get an
AccessDeniedException. This has never happened before, so I am unsure what has gone wrong. The code used to save the file can be found below:
// Ignore undefined variables, this is a snippet.
ConfigurationLoader<?> manager = HoconConfigurationLoader.builder().setFile(file).build();
“Checked exception thrown when a file system operation is denied, typically due to a file permission or other access check.”
Likely means that you don’t have permission to write to your config file.
Why could this be? The config file is located in a folder inside of my
Documents folder on Windows.
EDIT: The code was running in a separate thread. Moving it to the main thread fixed the problem. Any idea why this happening?
If you give us the whole exception stack trace, we might be able to track down the problem…
Basically what @xfel said. It’d probably also be better to add an
EconomyLite#getLogger() function, and then put the
manager.save(root) into a try-catch block (as shown in docs )
That is the entire stack trace. There is nothing else that I could possibly post.
As I said in the main post, that is a snippet of code. In the actual plugin, it is surrounded by a try-catch block.
I really don’t know then; maybe your saving it when it’s already open then? Still have no idea how that could happen, but that’s all I can come up with.
I think the issue is that I am saving the same file too many times in too short of a period of time. Since each save is run in an async thread, the file is being saved again before it has finished saving the previous time. Hopefully that all makes sense.
I was gonna say concurrency issues yesterday but had to leave so never pressed post