{"record":{"id":"676c7c06c0bf15d9","repo":"apache/hadoop","slug":"suite-suiteclassname-is-empty-for-both-api","errorCode":null,"errorMessage":"suite \" + suiteClassName + \" is empty for both API and SHELL","messagePattern":"suite \" \\+ suiteClassName \\+ \" is empty for both API and SHELL","errorType":"validation","errorClass":"HdfsCompatIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/common/HdfsCompatCommand.java","lineNumber":104,"sourceCode":"      this.suite = (HdfsCompatSuite) suiteObj;\n    } else {\n      throw new HdfsCompatIllegalArgumentException(\n          \"class name \" + suiteClassName + \" must be an\" +\n              \" implementation of \" + HdfsCompatSuite.class.getName());\n    }\n    if (suite.getSuiteName() == null || suite.getSuiteName().isEmpty()) {\n      throw new HdfsCompatIllegalArgumentException(\n          \"suite \" + suiteClassName + \" suiteName is empty\");\n    }\n    for (HdfsCompatSuite defaultSuite : defaultSuites.values()) {\n      if (suite.getSuiteName().equalsIgnoreCase(defaultSuite.getSuiteName())) {\n        throw new HdfsCompatIllegalArgumentException(\n            \"suite \" + suiteClassName + \" suiteName\" +\n                \" conflicts with default suite \" + defaultSuite.getSuiteName());\n      }\n    }\n    if (!hasApiCase() && !hasShellCase()) {\n      throw new HdfsCompatIllegalArgumentException(\n          \"suite \" + suiteClassName + \" is empty for both API and SHELL\");\n    }\n  }\n\n  private boolean hasApiCase() {\n    return (suite.getApiCases() != null) &&\n        (suite.getApiCases().length > 0);\n  }\n\n  private boolean hasShellCase() {\n    return (suite.getShellCases() != null) &&\n        (suite.getShellCases().length > 0);\n  }\n\n  @VisibleForTesting\n  protected Map<String, HdfsCompatSuite> getDefaultSuites() {\n    Map<String, HdfsCompatSuite> defaultSuites = new HashMap<>();\n    defaultSuites.put(\"all\", new HdfsCompatSuiteForAll());","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/common/HdfsCompatCommand.java#L86-L122","documentation":"A loaded suite must contain at least one API case (getApiCases()) or one shell case (getShellCases()); if both arrays are null or empty, initSuite throws HdfsCompatIllegalArgumentException, because a suite with nothing to run is a broken or half-finished definition.","triggerScenarios":"A custom HdfsCompatSuite where getApiCases() and getShellCases() both return null or zero-length arrays — e.g. case classes written but never wired into the returned arrays, or case lists built conditionally and empty at runtime.","commonSituations":"Template suites with TODO placeholder arrays; refactoring that moved case classes but left getters returning the old empty arrays; deploying an early stub of the suite jar.","solutions":["Return at least one HdfsCompatApiCase or HdfsCompatShellCase, ideally from statically initialized arrays","If the suite is intentionally API-only or shell-only, that is fine — only one side needs to be non-empty","Verify the deployed jar is the build that contains the cases"],"exampleFix":"// before\n@Override public HdfsCompatApiCase[] getApiCases() { return new HdfsCompatApiCase[0]; }\n@Override public HdfsCompatShellCase[] getShellCases() { return null; }\n// -> suite ... is empty for both API and SHELL\n\n// after\n@Override public HdfsCompatApiCase[] getApiCases() {\n  return new HdfsCompatApiCase[]{ new MyListStatusCase(), new MyRenameCase() };\n}","handlingStrategy":"validation","validationCode":"HdfsCompatSuite s = (HdfsCompatSuite) Class.forName(cls).getConstructor().newInstance();\nboolean hasCases = (s.getApiCases() != null && s.getApiCases().length > 0)\n    || (s.getShellCases() != null && s.getShellCases().length > 0);\nif (!hasCases) {\n  throw new IllegalArgumentException(cls + \" defines no API and no SHELL cases\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize case arrays as static finals so they cannot be empty at runtime","Include an 'at least one case' assertion in the suite's unit test"],"tags":["hadoop-compat-bench","suite-registration","plugin-validation"],"backgroundTag":"empty-plugin-registration","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}