{"record":{"id":"86680707abfb3456","repo":"apache/flink","slug":"hadoop-jobconf-must-not-be-null-when-input-split-i","errorCode":null,"errorMessage":"Hadoop JobConf must not be null when input split is configurable.","messagePattern":"Hadoop JobConf must not be null when input split is configurable\\.","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/wrapper/HadoopInputSplit.java","lineNumber":62,"sourceCode":"\n    private final Class<? extends org.apache.hadoop.mapred.InputSplit> splitType;\n\n    private transient org.apache.hadoop.mapred.InputSplit hadoopInputSplit;\n\n    @Nullable private transient JobConf jobConf;\n\n    public HadoopInputSplit(\n            int splitNumber,\n            org.apache.hadoop.mapred.InputSplit hInputSplit,\n            @Nullable JobConf jobconf) {\n        super(splitNumber, (String) null);\n\n        if (hInputSplit == null) {\n            throw new NullPointerException(\"Hadoop input split must not be null\");\n        }\n\n        if (needsJobConf(hInputSplit) && jobconf == null) {\n            throw new NullPointerException(\n                    \"Hadoop JobConf must not be null when input split is configurable.\");\n        }\n\n        this.splitType = hInputSplit.getClass();\n\n        this.jobConf = jobconf;\n        this.hadoopInputSplit = hInputSplit;\n    }\n\n    // ------------------------------------------------------------------------\n    //  Properties\n    // ------------------------------------------------------------------------\n\n    @Override\n    public String[] getHostnames() {\n        try {\n            return this.hadoopInputSplit.getLocations();\n        } catch (IOException e) {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/wrapper/HadoopInputSplit.java#L44-L80","documentation":"Thrown by the HadoopInputSplit constructor when the InputSplit implements Hadoop's Configurable interface (meaning it needs a JobConf to configure itself after deserialization) but the provided JobConf is null. Configurable splits cannot function without configuration, so the constructor rejects the null JobConf.","triggerScenarios":"Constructing a HadoopInputSplit(splitNumber, hInputSplit, null) where hInputSplit implements org.apache.hadoop.conf.Configurable — typically after deserialization when the JobConf was not passed to the split wrapper.","commonSituations":"Deserializing a HadoopInputSplit without restoring its JobConf; custom split distribution code that strips the JobConf; test code that creates Configurable splits without providing configuration.","solutions":["Always pass a non-null JobConf when constructing HadoopInputSplit for Configurable InputSplits.","In deserialization paths (readFields), ensure the JobConf is deserialized and set before the split is used.","Use HadoopInputSplit.updateJobConf(jobConf) after deserialization if the JobConf was not available at construction time."],"exampleFix":"// before — Configurable split with null JobConf\nHadoopInputSplit split = new HadoopInputSplit(0, configurableInputSplit, null);\n// after — provide the JobConf\nHadoopInputSplit split = new HadoopInputSplit(0, configurableInputSplit, jobConf);\n// or update after deserialization\nsplit.updateJobConf(jobConf);","handlingStrategy":"validation","validationCode":"// Check if the split is Configurable and ensure JobConf is provided\nif (hInputSplit instanceof org.apache.hadoop.conf.Configurable && jobConf == null) {\n    throw new IllegalArgumentException(\n        \"Configurable InputSplit requires a non-null JobConf\");\n}\nHadoopInputSplit split = new HadoopInputSplit(splitNumber, hInputSplit, jobConf);","typeGuard":"public static boolean needsJobConf(org.apache.hadoop.mapred.InputSplit split) {\n    return split instanceof org.apache.hadoop.conf.Configurable;\n}","tryCatchPattern":null,"preventionTips":["Always pass a non-null JobConf when constructing HadoopInputSplit for Configurable splits.","After deserialization, call updateJobConf(jobConf) if the JobConf was not available at construction.","Test Configurable InputSplit round-trip (serialize/deserialize) with a real JobConf."],"tags":["hadoop-compatibility","input-split","null-check","internal-api"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}