{"record":{"id":"fbf78d9cd400e058","repo":"alibaba/arthas","slug":"optionname-must-not-be-blank","errorCode":null,"errorMessage":"{optionName} must not be blank.","messagePattern":"(.+?) must not be blank\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderMetaspaceCommand.java","lineNumber":458,"sourceCode":"                if (blockCompare != 0) {\n                    return blockCompare;\n                }\n                return safeName(o1).compareTo(safeName(o2));\n            }\n        });\n        if (limit == null || sorted.size() <= limit) {\n            return sorted;\n        }\n        return new ArrayList<Row>(sorted.subList(0, limit));\n    }\n\n    private static String safeName(Row row) {\n        return row.getName() == null ? \"\" : row.getName();\n    }\n\n    static long parseTimeMillis(String value, String optionName) {\n        if (StringUtils.isBlank(value)) {\n            throw new IllegalArgumentException(optionName + \" must not be blank.\");\n        }\n\n        String text = value.trim().toLowerCase();\n        long multiplier = 1;\n        if (text.endsWith(\"ms\")) {\n            text = text.substring(0, text.length() - 2).trim();\n        } else if (text.endsWith(\"s\")) {\n            text = text.substring(0, text.length() - 1).trim();\n            multiplier = 1000;\n        } else if (text.endsWith(\"m\")) {\n            text = text.substring(0, text.length() - 1).trim();\n            multiplier = 60 * 1000;\n        }\n\n        try {\n            long millis = Long.parseLong(text) * multiplier;\n            if (millis <= 0) {\n                throw new IllegalArgumentException(optionName + \" must be greater than 0.\");","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderMetaspaceCommand.java#L440-L476","documentation":"Thrown as IllegalArgumentException by ClassLoaderMetaspaceCommand.parseTimeMillis when the value passed for a time option (optionName) is null or blank (StringUtils.isBlank). parseTimeMillis expects a non-empty duration string with optional ms/s/m suffix and a numeric body.","triggerScenarios":"Invoke the classloader command with a time option (e.g. --refresh-interval or similar) given an empty string or omitted-but-supplied-blank value. Any option routed through parseTimeMillis with isBlank value triggers this before unit parsing.","commonSituations":"User supplies --option '' (empty quotes); a wrapper script passes an unset environment variable that resolves to blank; a UI that submits the field empty.","solutions":["Supply a concrete duration: e.g. 30s, 5m, 200ms, or a bare number (interpreted as ms).","Omit the option entirely rather than passing blank if you want the default.","Validate the option string before invoking the command."],"exampleFix":"// before\nclassloader --refresh-interval ''\n\n// after\nclassloader --refresh-interval 5s","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(value)) {\n    // omit the option or supply a real duration before calling parseTimeMillis\n}","typeGuard":"static boolean hasDurationText(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try { long ms = ClassLoaderMetaspaceCommand.parseTimeMillis(value, optionName); } catch (IllegalArgumentException e) { /* prompt user for a non-blank duration */ }","preventionTips":["Omit the option rather than passing blank to get the default.","Validate non-blank before invoking the command.","Guard wrapper scripts against unset env vars resolving to empty."],"tags":["classloader","user-input","parsing","configuration"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}