ReloadablePropertiesAnnotation icon indicating copy to clipboard operation
ReloadablePropertiesAnnotation copied to clipboard

Incorrect check on Path

Open vincentmonier opened this issue 10 years ago • 1 comments

In class PropertiesWatcher method pathMatchResources does not always work. indeed it uses Path.getFileName().toString() method to compare with resource. But toString method does not always returns file name as expected, depending on OS and JDK version.

it's a better approach to use equals method.

    private boolean pathMatchesResource(final Path target, final Resource resource) {
         //at this point target cannot be null
         return Paths.get(resource.getFilename()).equals(target);
    }

of course this method works only for file resources.

vincentmonier avatar Jul 17 '14 13:07 vincentmonier

:+1: Cheers, on a PR with and tests which are needed and I will merge it in. Thanks

jamesmorgan avatar Jul 17 '14 15:07 jamesmorgan