{"record":{"id":"a8f8c5f1987b8f0b","repo":"apereo/cas","slug":"resource-does-not-exist-or-is-unreadable","errorCode":null,"errorMessage":"Resource  does not exist or is unreadable","messagePattern":"Resource  does not exist or is unreadable","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java","lineNumber":171,"sourceCode":"            val resource = getResourceFrom(location);\n            return doesResourceExist(resource);\n        } catch (final Exception e) {\n            LOGGER.trace(e.getMessage());\n        }\n        return false;\n    }\n\n    /**\n     * Gets resource from a String location.\n     *\n     * @param location the metadata location\n     * @return the resource from\n     * @throws IOException the exception\n     */\n    public static AbstractResource getResourceFrom(final String location) throws IOException {\n        val resource = getRawResourceFrom(location);\n        if (!resource.exists() || (resource.isFile() && resource.getFile().isFile() && !resource.isReadable())) {\n            throw new FileNotFoundException(\"Resource \" + location + \" does not exist or is unreadable\");\n        }\n        return resource;\n    }\n\n    /**\n     * Export classpath resource to file.\n     *\n     * @param parentDirectory the parent directory\n     * @param resource        the resource\n     * @return the resource\n     */\n    public static @Nullable Resource exportClasspathResourceToFile(final File parentDirectory, final Resource resource) {\n        LOGGER.trace(\"Preparing classpath resource [{}]\", resource);\n        if (resource == null) {\n            LOGGER.warn(\"No resource defined to prepare.\");\n            return null;\n        }\n        if (!parentDirectory.exists() && !parentDirectory.mkdirs()) {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java#L153-L189","documentation":"getResourceFrom(location) resolved the location string to a Resource, but the resource does not exist on disk/classpath/URL, or it is a file that is not readable. FileNotFoundException indicates a bad path or missing permissions rather than a malformed location string. The input at fault is the resolved location.","triggerScenarios":"Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java:171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the path/URL is correct and the file actually exists","Check filesystem read permissions for the CAS process user","For classpath resources, confirm the file is packaged in the deployed artifact"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}