PropertiesConfiguration doesn't reload with Symbolic link

92 views Asked by At

Considering the scenario where 'file' is a symbolic link to a real one

file -> real_file

if I configure PropertiesConfiguration (from Apache Commons Config) to open the symbolic link it doens't reload it if I update the real file

String filePath = new File(path).getCanonicalPath();
PropertiesConfiguration configuration = new PropertiesConfiguration(new File(filePath));
configuration.setReloadingStrategy(new FileChangedReloadingStrategy());

Of course, in this case the update date of the symbolic link is unchanged, unlike the real one.

Is there a way to force PropertiesConfiguration to follow symbolic link and recognize changes on real file?

1

There are 1 answers

0
Alessio Fiore On

The problem is that .getCanonicalPath() open the pointed file and not the symblink. If someone replace the real file with another one PropertiecConfiguration is still pointing to an not existing file, so the reload doens't work