{"record":{"id":"43e3885994c52e3c","repo":"apache/hadoop","slug":"mark-not-supported-43e388","errorCode":null,"errorMessage":"mark not supported","messagePattern":"mark not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/prefetch/S3ARemoteInputStream.java","lineNumber":473,"sourceCode":"    if (closed) {\n      throw new IOException(\n          name + \": \" + FSExceptionMessages.STREAM_IS_CLOSED);\n    }\n  }\n\n  protected void throwIfInvalidSeek(long pos) throws EOFException {\n    if (pos < 0) {\n      throw new EOFException(FSExceptionMessages.NEGATIVE_SEEK + \" \" + pos);\n    } else if (pos > this.getBlockData().getFileSize()) {\n      throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF + \" \" + pos);\n    }\n  }\n\n  // Unsupported functions.\n\n  @Override\n  public void mark(int readlimit) {\n    throw new UnsupportedOperationException(\"mark not supported\");\n  }\n\n  @Override\n  public void reset() {\n    throw new UnsupportedOperationException(\"reset not supported\");\n  }\n\n  @Override\n  public long skip(long n) {\n    throw new UnsupportedOperationException(\"skip not supported\");\n  }\n}\n","sourceCodeStart":455,"sourceCodeEnd":486,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/prefetch/S3ARemoteInputStream.java#L455-L486","documentation":"S3ARemoteInputStream.mark() always throws UnsupportedOperationException(\"mark not supported\"). This inner stream of the prefetching S3A input stream supports positional reads and seek, but not the mark/reset protocol of java.io.InputStream.","triggerScenarios":"Calling mark() on S3ARemoteInputStream directly (tests, extracted inner stream); generic libraries that unconditionally call mark() without checking markSupported() (some parsers, compression codecs).","commonSituations":"Third-party readers that rely on BufferedInputStream semantics being handed the raw remote stream; unit tests exercising mark on prefetch block data; debugging code that grabs the inner stream.","solutions":["Do not call mark() on this stream; use seek(getPos()) to reposition instead.","If a library needs mark/reset, wrap the stream in BufferedInputStream (its markSupported() is true and it buffers internally).","Check markSupported() before calling mark() in shared utility code.","Use the public S3A FSDataInputStream API rather than the internal S3ARemoteInputStream."],"exampleFix":"// before\nstream.mark(1024); // UnsupportedOperationException on S3ARemoteInputStream\n\n// after\nif (stream.markSupported()) {\n  stream.mark(1024);\n} else {\n  long markPos = stream.getPos(); // reposition with seek later\n}\n// or: BufferedInputStream buffered = new BufferedInputStream(stream);\n//     buffered.mark(1024); buffered.reset();","handlingStrategy":"validation","validationCode":"if (stream.markSupported()) {\n  stream.mark(readlimit);\n} else {\n  markPos = stream.getPos(); // fall back to seek-based checkpoint\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check markSupported() before mark() in any generic stream utility.","Prefer seek(getPos()) checkpoints on Hadoop filesystem streams.","Wrap in BufferedInputStream when a component requires mark/reset."],"tags":["hadoop-aws","prefetch","unsupported-operation","mark-reset"],"backgroundTag":"unsupported-operation-exception","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}