{"record":{"id":"7409159584328b69","repo":"apache/hadoop","slug":"invalid-buffer-found-not-allowing-null-740915","errorCode":null,"errorMessage":"Invalid buffer found, not allowing null","messagePattern":"Invalid buffer found, not allowing null","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java","lineNumber":94,"sourceCode":"      buffer = outputs[i];\n      outputOffsets[i] = buffer.arrayOffset() + buffer.position();\n      newOutputs[i] = buffer.array();\n    }\n\n    ByteArrayEncodingState baeState = new ByteArrayEncodingState(encoder,\n        encodeLength, newInputs, inputOffsets, newOutputs, outputOffsets);\n    return baeState;\n  }\n\n  /**\n   * Check and ensure the buffers are of the desired length and type, direct\n   * buffers or not.\n   * @param buffers the buffers to check\n   */\n  void checkBuffers(ByteBuffer[] buffers) {\n    for (ByteBuffer buffer : buffers) {\n      if (buffer == null) {\n        throw new HadoopIllegalArgumentException(\n            \"Invalid buffer found, not allowing null\");\n      }\n\n      if (buffer.remaining() != encodeLength) {\n        throw new HadoopIllegalArgumentException(\n            \"Invalid buffer, not of length \" + encodeLength);\n      }\n      if (buffer.isDirect() != usingDirectBuffer) {\n        throw new HadoopIllegalArgumentException(\n            \"Invalid buffer, isDirect should be \" + usingDirectBuffer);\n      }\n    }\n  }\n}\n","sourceCodeStart":76,"sourceCodeEnd":109,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java#L76-L109","documentation":"Error \"Invalid buffer found, not allowing null\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/ByteBufferEncodingState.java:94 when the library encounters an invalid state.","commonSituations":"Occurs when a null buffer is passed into an encoding state. Validate all input/output buffers are non-null before performing the encode step.","solutions":["Ensure every entry in the inputs and outputs arrays is a non-null ByteBuffer before encoding.","Initialize all output buffers with the correct capacity before calling encode."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}