{"record":{"id":"58f4239141c621e5","repo":"apache/hadoop","slug":"need-to-set-transport","errorCode":null,"errorMessage":"Need to set transport!","messagePattern":"Need to set transport!","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java","lineNumber":319,"sourceCode":"    simpleKdc.setKdcRealm(realm);\n    if (transport == null) {\n      transport = conf.getProperty(TRANSPORT);\n    }\n    if (port == 0) {\n      port = NetworkUtil.getServerPort();\n    }\n    if (transport != null) {\n      if (transport.trim().equals(\"TCP\")) {\n        simpleKdc.setKdcTcpPort(port);\n        simpleKdc.setAllowUdp(false);\n      } else if (transport.trim().equals(\"UDP\")) {\n        simpleKdc.setKdcUdpPort(port);\n        simpleKdc.setAllowTcp(false);\n      } else {\n        throw new IllegalArgumentException(\"Invalid transport: \" + transport);\n      }\n    } else {\n      throw new IllegalArgumentException(\"Need to set transport!\");\n    }\n    simpleKdc.getKdcConfig().setString(KdcConfigKey.KDC_SERVICE_NAME,\n            conf.getProperty(INSTANCE));\n    if (conf.getProperty(DEBUG) != null) {\n      krb5Debug = getAndSet(SUN_SECURITY_KRB5_DEBUG, conf.getProperty(DEBUG));\n    }\n    if (conf.getProperty(MIN_TICKET_LIFETIME) != null) {\n      simpleKdc.getKdcConfig().setLong(KdcConfigKey.MINIMUM_TICKET_LIFETIME,\n          Long.parseLong(conf.getProperty(MIN_TICKET_LIFETIME)));\n    }\n    if (conf.getProperty(MAX_TICKET_LIFETIME) != null) {\n      simpleKdc.getKdcConfig().setLong(KdcConfigKey.MAXIMUM_TICKET_LIFETIME,\n          Long.parseLong(conf.getProperty(MiniKdc.MAX_TICKET_LIFETIME)));\n    }\n  }\n\n  /**\n   * Stops the MiniKdc","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java#L301-L337","documentation":"MiniKdc.start() requires a non-null 'transport' property and throws IllegalArgumentException(\"Need to set transport!\") otherwise. The constructor already rejects a Properties object missing any required key ('Missing configuration properties' includes transport), so this branch fires when the Properties is mutated between construction and start() — e.g. the transport key is removed — or a Properties populated with put() holds a null value.","triggerScenarios":"conf.remove(\"transport\") or setting it to null after new MiniKdc(conf, dir) but before start(); a Properties built via put(\"transport\", null); a Properties subclass whose getProperty() is inconsistent with keySet().","commonSituations":"Test harnesses that strip keys from a shared config template between construction and start(); programmatic config filtering; passing a shared mutable Properties object that another thread or helper mutates.","solutions":["Use MiniKdc.createConf() (or a copy) and pass it untouched to the constructor, then start() without further mutation","Treat the Properties handed to MiniKdc as owned by the KDC after construction; do not mutate it","If filtering is needed, build the filtered copy before constructing MiniKdc and assert conf.getProperty(\"transport\") != null"],"exampleFix":"// before\nProperties conf = MiniKdc.createConf();\nMiniKdc kdc = new MiniKdc(conf, workDir);\nconf.remove(\"transport\"); // mutation after construction\nkdc.start(); // -> Need to set transport!\n\n// after\nProperties conf = MiniKdc.createConf();\nconf.remove(\"debug\"); // safe: not required by start()\nMiniKdc kdc = new MiniKdc(conf, workDir);\nkdc.start();","handlingStrategy":"validation","validationCode":"MiniKdc kdc = new MiniKdc(conf, workDir);\n// fail fast if config was mutated between construction and start\nPreconditions.checkNotNull(conf.getProperty(\"transport\"), \"transport removed from MiniKdc conf\");\nkdc.start();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat the Properties handed to MiniKdc as immutable after construction","Build config copies from MiniKdc.createConf() rather than mutating shared templates","Do not strip keys from a shared Properties object between new MiniKdc() and start()"],"tags":["kerberos","minikdc","configuration","null-config"],"backgroundTag":"missing-required-config","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}