{"record":{"id":"28f67ed20f2e5516","repo":"Tencent/matrix","slug":"path-not-valid-path","errorCode":null,"errorMessage":"path NOT valid: <path>","messagePattern":"path NOT valid: <path>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-hooks/src/main/java/com/tencent/matrix/hook/pthread/PthreadHook.java","lineNumber":128,"sourceCode":"\n    public PthreadHook setThreadStackShrinkConfig(@Nullable ThreadStackShrinkConfig config) {\n        mThreadStackShrinkConfig = config;\n        return this;\n    }\n\n    /**\n     * notice: it is an exclusive interface\n     */\n    public void hook() throws HookManager.HookFailedException {\n        HookManager.INSTANCE\n                .clearHooks()\n                .addHook(this)\n                .commitHooks();\n    }\n\n    public void dump(String path) {\n        if (TextUtils.isEmpty(path)) {\n            throw new IllegalArgumentException(\"path NOT valid: \" + path);\n        }\n        if (getStatus() == Status.COMMIT_SUCCESS) {\n            dumpNative(path);\n        }\n    }\n\n    public void enableQuicken(boolean enable) {\n        mEnableQuicken = enable;\n        if (mConfigured) {\n            enableQuickenNative(mEnableQuicken);\n        }\n    }\n\n    public void enableLogger(boolean enable) {\n        mEnableLog = enable;\n        if (mConfigured) {\n            enableLoggerNative(mEnableLog);\n        }","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-hooks/src/main/java/com/tencent/matrix/hook/pthread/PthreadHook.java#L110-L146","documentation":"PthreadHook.dump(path) writes the pthread-hook dump to the given file path. It first validates the path and throws IllegalArgumentException(\"path NOT valid: \" + path) if the path is null or empty. Additionally, the dump only actually runs via dumpNative(path) when the hook's status is COMMIT_SUCCESS — an uncommitted hook silently skips the dump.","triggerScenarios":"Calling pthreadHook.dump(path) with a null or empty (including whitespace-empty per TextUtils.isEmpty) string instead of a valid file path.","commonSituations":"A config parameter or intent extra holding the dump path was never set; constructing the path with an uninitialized variable; retrieving a path from preferences/arguments that defaulted to \"\"; forgetting that dump also requires the hook to have been committed successfully first.","solutions":["Pass a non-empty absolute file path, e.g. context.getExternalFilesDir(null) + \"/pthread_dump.txt\".","Ensure the value comes from a source that is actually populated (intent extra, config) — log it before calling dump().","Also confirm getStatus() == COMMIT_SUCCESS, otherwise dump() does nothing even with a valid path.","Guard the call: skip dump() when the path is empty instead of letting it throw."],"exampleFix":"// before\nString path = getIntent().getStringExtra(\"dump_path\");\npthreadHook.dump(path); // may be null/empty\n// after\nString path = getIntent().getStringExtra(\"dump_path\");\nif (!TextUtils.isEmpty(path) && pthreadHook.getStatus() == Status.COMMIT_SUCCESS) {\n    pthreadHook.dump(path);\n}","handlingStrategy":"validation","validationCode":"if (path == null || TextUtils.isEmpty(path.trim())) {\n    return; // or use a default path\n}","typeGuard":null,"tryCatchPattern":"try {\n    pthreadHook.dump(path);\n} catch (IllegalArgumentException e) {\n    MatrixLog.e(TAG, \"dump skipped: \" + e.getMessage());\n}","preventionTips":["Resolve dump paths from context.getExternalFilesDir() rather than raw config strings.","Log the path value before calling dump() to catch empty config extras early.","Remember dump() also requires Status.COMMIT_SUCCESS — check it before calling."],"tags":["validation","path","pthread-hook","illegal-argument"],"backgroundTag":"empty-required-field","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}