{"record":{"id":"fa6527b786c7ff9b","repo":"NationalSecurityAgency/ghidra","slug":"invalid-absolute-file-path","errorCode":null,"errorMessage":"Invalid absolute file path: ","messagePattern":"Invalid absolute file path: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java","lineNumber":257,"sourceCode":"\t\t}\n\t\telse if (pwdSep > 0 && (userinfo.length() - pwdSep) == 0) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid userinfo specified\");\n\t\t}\n\t\treturn userinfo;\n\t}\n\n\tprivate static String cleanupFilename(String name) {\n\t\t// transform dbName into acceptable H2 DB file path\n\n\t\tMatcher m = BAD_H2_CHARS_PATTERN.matcher(name);\n\t\tif (m.matches()) {\n\t\t\tthrow new IllegalArgumentException(\"Bad character in H2 database path. \" +\n\t\t\t\t\"Disallowed characters: \" + BAD_H2_CHARS);\n\t\t}\n\t\tString dbName = name.trim();\n\t\tdbName = dbName.replace(\"\\\\\", \"/\");\n\t\tif ((!dbName.startsWith(\"/\") && !isWindowsFilePath(dbName)) || dbName.endsWith(\"/\")) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid absolute file path: \" + dbName);\n\t\t}\n\t\tif (!dbName.endsWith(H2_FILE_EXTENSION)) {\n\t\t\tdbName += H2_FILE_EXTENSION;\n\t\t}\n\t\treturn dbName;\n\t}\n\n\tprivate static String checkURLField(String val, String name) {\n\t\tif (StringUtils.isEmpty(val)) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid \" + name + \" in URL\");\n\t\t}\n\t\treturn val.trim();\n\t}\n\n\t/**\n\t * Determine if this server info corresponds to Windows OS file path.\n\t * @return true if this server info corresponds to Windows OS file path.\n\t */","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java#L239-L275","documentation":"Thrown by cleanupFilename() when the file-type database path, after trimming and backslash-to-slash conversion, is not an absolute path. The path must start with '/' (Unix absolute) or match the Windows drive-letter pattern (isWindowsFilePath), and must not end with a trailing '/'. Throws IllegalArgumentException.","triggerScenarios":"Constructing a file-type BSimServerInfo with a relative path like 'bsim.mv.db' or 'data/bsim.mv.db', or a path ending in '/', e.g. 'new BSimServerInfo(\"/opt/bsim/\")'.","commonSituations":"Passing a relative working-directory path instead of an absolute one; trailing slash from directory join logic; Windows path not recognized as a drive path.","solutions":["Provide an absolute path starting with '/' (Unix) or a drive letter (Windows), e.g. '/opt/bsim/data.mv.db'.","Remove any trailing slash from the path.","Resolve relative paths to absolute with java.nio.file.Path.toAbsolutePath() before constructing."],"exampleFix":"// before (relative path)\nnew BSimServerInfo(\"data/bsim.mv.db\");\n// after (absolute path)\nPath abs = Path.of(\"data/bsim.mv.db\").toAbsolutePath();\nnew BSimServerInfo(abs.toString());","handlingStrategy":"validation","validationCode":"String p = dbName.trim().replace(\"\\\\\", \"/\");\nboolean isWinDrive = p.length() >= 2 && p.charAt(1) == ':';\nif ((!p.startsWith(\"/\") && !isWinDrive) || p.endsWith(\"/\")) {\n    throw new IllegalArgumentException(\"BSim file path must be absolute and not end with '/': \" + p);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an absolute path (or Windows drive path) to file-type BSimServerInfo.","Resolve relative paths with Path.toAbsolutePath() before constructing.","Strip trailing slashes produced by directory-join logic."],"tags":["bsim","validation","h2","database-url","filesystem"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}