{"record":{"id":"6d862d3ef5fbfc3e","repo":"apache/hadoop","slug":"skip-not-supported","errorCode":null,"errorMessage":"skip not supported","messagePattern":"skip 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":483,"sourceCode":"      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":465,"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#L465-L486","documentation":"S3ARemoteInputStream.skip() always throws UnsupportedOperationException(\"skip not supported\"). Skipping forward must be done by seek(pos + n) on this seekable stream; the InputStream skip idiom (reading and discarding) was deliberately not implemented.","triggerScenarios":"Calling skip(n) on the prefetcher's remote stream - often from libraries that use skip() as their standard 'advance' operation (compression streams, archive readers); test code using skip in read loops.","commonSituations":"Tools (gzip/zip/tar readers) that skip headers or entries; frameworks defaulting to skip() instead of seek() on FSDataInputStream; ported local-filesystem code.","solutions":["Replace skip(n) with seek(getPos() + n) on the seekable stream.","Guard generic code: if (!stream.markSupported() && stream instanceof Seekable) { seek } else { skip } - or simply prefer seek on FSDataInputStream.","Wrap the stream in BufferedInputStream, whose skip() works by buffered reads.","Keep utility readers configurable to use seek-based positioning for Hadoop streams."],"exampleFix":"// before\nlong remaining = n;\nwhile (remaining > 0) { remaining -= stream.skip(remaining); } // throws\n\n// after\nif (stream instanceof org.apache.hadoop.fs.Seekable) {\n  ((org.apache.hadoop.fs.Seekable) stream).seek(stream.getPos() + n);\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Replace skip(n) with seek(getPos() + n) on FSDataInputStream/Seekable streams.","Test stream-adapters against Hadoop filesystems, not just local files.","BufferedInputStream wrapping also neutralizes skip() calls from libraries."],"tags":["hadoop-aws","prefetch","unsupported-operation","skip"],"backgroundTag":"unsupported-operation-exception","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}