{"record":{"id":"0e7fc51f85db2f21","repo":"apache/hadoop","slug":"s-is-not-available","errorCode":null,"errorMessage":"%s is not available","messagePattern":"(.+?) is not available","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/api/DNSOperationsFactory.java","lineNumber":70,"sourceCode":"   * Access rights will be determined from the configuration.\n   *\n   * @param name name of the instance\n   * @param impl the DNS implementation.\n   * @param conf configuration\n   * @return a registry operations instance\n   */\n  public static DNSOperations createInstance(String name,\n      DNSImplementation impl,\n      Configuration conf) {\n    Preconditions.checkArgument(conf != null, \"Null configuration\");\n    DNSOperations operations = null;\n    switch (impl) {\n    case DNSJAVA:\n      operations = new RegistryDNS(name);\n      break;\n\n    default:\n      throw new IllegalArgumentException(\n          String.format(\"%s is not available\", impl.toString()));\n    }\n\n    //operations.init(conf);\n    return operations;\n  }\n\n}\n","sourceCodeStart":52,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/api/DNSOperationsFactory.java#L52-L79","documentation":"DNSOperationsFactory.createInstance(name, impl, conf) maps a DNSImplementation enum to a backing implementation. Only DNSJAVA is wired (new RegistryDNS(name)); every other value falls into the default branch and throws IllegalArgumentException('<impl> is not available').","triggerScenarios":"Passing any DNSImplementation constant other than DNSJAVA — reachable when the enum grows new constants (or downstream code resolves the enum dynamically, e.g. DNSImplementation.valueOf(config)) and this factory has not been extended. A null conf fails earlier on the Preconditions check.","commonSituations":"Extending hadoop-registry with a new DNS backend enum constant but forgetting the factory switch case; resolving the implementation name from configuration with valueOf(); forks where the enum and factory diverge.","solutions":["Pass DNSImplementation.DNSJAVA — the only supported implementation today","When adding a DNSImplementation constant, add its case to this switch in the same change","If the value comes from configuration, whitelist 'DNSJAVA' and fail with a clear message on anything else"],"exampleFix":"// before\nDNSOperations ops = DNSOperationsFactory.createInstance(name, parsedImpl, conf); // parsedImpl != DNSJAVA\n\n// after\nDNSOperations ops = DNSOperationsFactory.createInstance(name, DNSImplementation.DNSJAVA, conf);","handlingStrategy":"validation","validationCode":"Preconditions.checkArgument(impl == DNSImplementation.DNSJAVA,\n    \"Only DNSJAVA DNS implementation is supported\");\nDNSOperations ops = DNSOperationsFactory.createInstance(name, impl, conf);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass DNSImplementation.DNSJAVA explicitly — the only wired implementation","When resolving the enum from configuration, whitelist known values and fail with a clear message","If you extend the enum, extend the factory switch in the same commit"],"tags":["registry","dns","configuration","unsupported-operation"],"backgroundTag":"unsupported-implementation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}