Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Incorrect check on Path #9

@vincentmonier

Description

@vincentmonier

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions