{"record":{"id":"51c14080ece8a3a3","repo":"aeron-io/aeron","slug":"classname-is-empty","errorCode":null,"errorMessage":"className is empty","messagePattern":"className is empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/checksum/Checksums.java","lineNumber":69,"sourceCode":"        return CRC_32C;\n    }\n\n    /**\n     * Factory method to create an instance of the {@link Checksum} interface.\n     *\n     * @param className fully qualified class name or an alias of the {@link Checksum} implementation.\n     * @return a {@link Checksum} instance.\n     * @throws IllegalArgumentException if {@code className == null} or empty.\n     * @throws IllegalStateException    if an attempt was made to acquire CRC-32C while running on JDK 8.\n     * @throws IllegalArgumentException if an error occurs while creating a {@link Checksum} instance.\n     * @throws ClassCastException       if created instance does not implement the {@link Checksum} interface.\n     * @see #crc32c()\n     */\n    public static Checksum newInstance(final String className)\n    {\n        if (Strings.isEmpty(className))\n        {\n            throw new IllegalArgumentException(\"className is empty\");\n        }\n\n        return switch (className)\n        {\n            case \"CRC-32\":\n            case \"io.aeron.archive.checksum.Crc32\":\n            case \"org.agrona.checksum.Crc32\":\n                yield crc32();\n            case \"CRC-32C\":\n            case \"io.aeron.archive.checksum.Crc32c\":\n            case \"org.agrona.checksum.Crc32c\":\n                yield crc32c();\n            default:\n            {\n                try\n                {\n                    final Class<?> klass = Class.forName(className);\n                    final Object instance = klass.getDeclaredConstructor().newInstance();","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/checksum/Checksums.java#L51-L87","documentation":"Checksums.newInstance(String) resolves a checksum implementation by class name for archive recording checksums. The library throws IllegalArgumentException when the className argument is null or the empty string, because no checksum can be resolved from a blank name. This is an eager argument validation done before any class lookup.","triggerScenarios":"Calling Checksum.newInstance(null) or Checksum.newInstance(\"\") — typically when the archive's recording checksum class name config property is unset or empty and is passed straight through.","commonSituations":"Configuration mistakes: the 'aeron.archive.recording.checksum.class.name' style system property not set (null) or set to an empty value, then fed to newInstance; or programmatic Context setup passing an empty checksum class name.","solutions":["Set the checksum class name property to a valid value, e.g. io.aeron.archive.checksum.Crc32 or io.aeron.archive.checksum.Crc32c, or use the CRC32()/CRC32C() factory helpers","Guard with Strings.isEmpty(className) or check for null/blank before calling newInstance","If checksumming is not required, avoid resolving an instance at all instead of passing an empty name"],"exampleFix":"// before\nChecksum checksum = Checksum.newInstance(System.getProperty(\"aeron.archive.checksum.class.name\", \"\"));\n// after\nString name = System.getProperty(\"aeron.archive.checksum.class.name\");\nChecksum checksum = (name != null && !name.isEmpty()) ? Checksum.newInstance(name) : Checksum.crc32();","handlingStrategy":"validation","validationCode":"if (className == null || className.isEmpty()) {\n    throw new IllegalArgumentException(\"checksum className must be non-empty\");\n}\nChecksum checksum = Checksum.newInstance(className);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default the checksum property to a concrete value (e.g. Crc32) instead of empty string","Validate configuration in Context/property loading code before reaching newInstance"],"tags":["java","configuration","argument-validation"],"backgroundTag":"empty-required-field","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}