{"record":{"id":"24c741267b7d5572","repo":"prestodb/presto","slug":"id-is-empty","errorCode":null,"errorMessage":"id is empty","messagePattern":"id is empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/memory/MemoryPoolId.java","lineNumber":37,"sourceCode":"import com.fasterxml.jackson.annotation.JsonCreator;\nimport com.fasterxml.jackson.annotation.JsonValue;\n\nimport java.util.Objects;\n\nimport static java.util.Objects.requireNonNull;\n\n@ThriftStruct\npublic final class MemoryPoolId\n{\n    private final String id;\n\n    @ThriftConstructor\n    @JsonCreator\n    public MemoryPoolId(String id)\n    {\n        requireNonNull(id, \"id is null\");\n        if (id.isEmpty()) {\n            throw new IllegalArgumentException(\"id is empty\");\n        }\n        this.id = id;\n    }\n\n    @ThriftField(1)\n    @JsonValue\n    public String getId()\n    {\n        return id;\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/memory/MemoryPoolId.java#L19-L55","documentation":"MemoryPoolId's constructor validates its id string: it must be non-null and non-empty. An empty string throws IllegalArgumentException(\"id is empty\"). MemoryPoolId names memory pools (e.g. 'general', 'reserved') in Presto's memory management, so it is usually constructed from configuration.","triggerScenarios":"Calling new MemoryPoolId(\"\") directly, or constructing a MemoryPool from a config property (e.g. memory pool name) that resolves to an empty string.","commonSituations":"Empty environment variable or properties file value for a pool name; test code building pools programmatically; config key present but value blank.","solutions":["Set the memory pool name property to a non-empty value (e.g. general).","Default the value in code: use a fallback when the config string is blank.","Trim and validate the input string before constructing MemoryPoolId."],"exampleFix":"// before\nMemoryPoolId poolId = new MemoryPoolId(config.getPoolName()); // may be \"\"\n\n// after\nString name = config.getPoolName();\nrequireNonNull(name, \"pool name is null\");\ncheckArgument(!name.trim().isEmpty(), \"pool name must not be empty\");\nMemoryPoolId poolId = new MemoryPoolId(name.trim());","handlingStrategy":"validation","validationCode":"if (id == null || id.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"memory pool id must be a non-empty string\");\n}","typeGuard":"boolean isValidMemoryPoolId(String id) {\n    return id != null && !id.isEmpty();\n}","tryCatchPattern":"try {\n    poolId = new MemoryPoolId(rawId);\n} catch (IllegalArgumentException e) {\n    poolId = new MemoryPoolId(\"general\"); // safe default\n}","preventionTips":["Never bind MemoryPoolId directly to config values without defaulting.","Validate environment/properties values for pool names at startup.","Use well-known constants (GENERAL_POOL, RESERVED_POOL) where possible."],"tags":["presto","spi","memory","illegal-argument","validation"],"backgroundTag":"invalid-empty-argument","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}