src/main/java/org/jmxtrans/agent/util/io/AbstractResource.java
@Override
    public boolean exists() {
        // Try file existence: can we find the file in the file system?
        try {
            return getFile().exists();
        }
        catch (IoRuntimeException ex) {
            // Fall back to stream existence: can we open the stream?
            try {
                try (InputStream is = getInputStream()) {
                	return true;
                }
            }
            catch (Throwable isEx) {
                return false;
            }
        }
    }
@Override
    public boolean exists() {
        // Try file existence: can we find the file in the file system?
        try {
            return getFile().exists();
        }
        catch (IoRuntimeException ex) {
            // Fall back to stream existence: can we open the stream?
            try {
                try (InputStream is = getInputStream()) {
                	return true;
                }
            }
            catch (Throwable isEx) {
                return false;
            }
        }
    }
This implementation checks whether a File can be opened,
falling back to whether an InputStream can be opened.
This will cover both directories and content resources.