{"record":{"id":"289dd45920aef490","repo":"apache/dolphinscheduler","slug":"the-resource-path-is-null","errorCode":null,"errorMessage":"The resource path is null","messagePattern":"The resource path is null","errorType":"validation","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/AbstractResourceValidator.java","lineNumber":58,"sourceCode":"import com.google.common.io.Files;\n\npublic abstract class AbstractResourceValidator<T> implements IValidator<T> {\n\n    private static final Set<String> FILE_SUFFIXES_WHICH_CAN_FETCH_CONTENT = new HashSet<>(Arrays.asList(\n            StringUtils.defaultIfBlank(FileUtils.getResourceViewSuffixes(), \"\").split(\",\")));\n\n    protected final StorageOperator storageOperator;\n\n    private final TenantDao tenantDao;\n\n    public AbstractResourceValidator(StorageOperator storageOperator, TenantDao tenantDao) {\n        this.storageOperator = storageOperator;\n        this.tenantDao = tenantDao;\n    }\n\n    public void exceptionResourceAbsolutePathInvalidated(String resourceAbsolutePath) {\n        if (StringUtils.isBlank(resourceAbsolutePath)) {\n            throw new ServiceException(\"The resource path is null\");\n        }\n        if (!resourceAbsolutePath.startsWith(storageOperator.getStorageBaseDirectory())) {\n            throw new ServiceException(\"Invalidated resource path: \" + resourceAbsolutePath);\n        }\n        if (resourceAbsolutePath.contains(\"..\")) {\n            throw new ServiceException(\"Invalidated resource path: \" + resourceAbsolutePath);\n        }\n    }\n\n    public void exceptionFileInvalidated(MultipartFile file) {\n        if (file == null) {\n            throw new ServiceException(\"The file is null\");\n        }\n    }\n\n    public void exceptionFileContentInvalidated(String fileContent) {\n        if (StringUtils.isEmpty(fileContent)) {\n            throw new ServiceException(\"The file content is null\");","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/AbstractResourceValidator.java#L40-L76","documentation":"AbstractResourceValidator.exceptionResourceAbsolutePathInvalidated first rejects a blank (null or empty/whitespace) resource absolute path with ServiceException(\"The resource path is null\"). It is the first guard in validating that resource paths used by resource-center APIs are present before checking prefix and traversal characters.","triggerScenarios":"Any resource API call (download, view content, update, delete) whose resourceAbsolutePath parameter resolves to null or an empty string, e.g. a resource name/id that maps to no stored path.","commonSituations":"Client omits the resource path parameter; a DB row has an empty file path column; frontend sends blank alias/name fields; copying a resource that never had a file uploaded.","solutions":["Provide the full resource absolute path (or valid resource id/full name) in the request.","Verify the target resource exists in the resource center and has a non-empty path.","In client code, check StringUtils.isNotBlank(path) before calling the API."],"exampleFix":"// before\nvalidator.exceptionResourceAbsolutePathInvalidated(\"\");\n// after\nvalidator.exceptionResourceAbsolutePathInvalidated(\"/alice/resources/script.sql\");","handlingStrategy":"validation","validationCode":"// client-side pre-check\nif (resourceAbsolutePath == null || resourceAbsolutePath.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"resourceAbsolutePath must be a non-empty path\");\n}","typeGuard":"function hasResourcePath(r) {\n  return typeof r.resourceAbsolutePath === 'string' && r.resourceAbsolutePath.trim().length > 0;\n}","tryCatchPattern":"try {\n    // download / view / update resource\n} catch (ServiceException e) {\n    if (e.getMessage().contains(\"The resource path is null\")) {\n        // re-resolve the resource full name from the listing API\n    } else throw e;\n}","preventionTips":["Fetch the resource's fullName from the listing API rather than constructing it","Check DB rows for empty path columns when migrating resources","Validate form fields as required in the resource-center UI"],"tags":["resource","validation","null-parameter"],"backgroundTag":"empty-required-field","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}