{"record":{"id":"dc65f2d12ec1b0d8","repo":"apache/hadoop","slug":"getclass-getcanonicalname-does-not-support-l","errorCode":null,"errorMessage":"{getClass().getCanonicalName()} does not support listCorruptFileBlocks","messagePattern":"(.+?) does not support listCorruptFileBlocks","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":1222,"sourceCode":"   * @throws AccessControlException access control exception.\n   * @throws FileNotFoundException file not found exception.\n   * @throws UnresolvedLinkException unresolved link exception.\n   * @throws IOException raised on errors performing I/O.\n   * @return FileStatus Iterator.\n   */\n  public abstract FileStatus[] listStatus(final Path f)\n      throws AccessControlException, FileNotFoundException,\n      UnresolvedLinkException, IOException;\n\n  /**\n   * @return an iterator over the corrupt files under the given path\n   * (may contain duplicates if a file has more than one corrupt block)\n   * @param path the path.\n   * @throws IOException raised on errors performing I/O.\n   */\n  public RemoteIterator<Path> listCorruptFileBlocks(Path path)\n    throws IOException {\n    throw new UnsupportedOperationException(getClass().getCanonicalName() +\n                                            \" does not support\" +\n                                            \" listCorruptFileBlocks\");\n  }\n\n  /**\n   * The specification of this method matches that of\n   * {@link FileContext#setVerifyChecksum(boolean, Path)} except that Path f\n   * must be for this file system.\n   *\n   * @param verifyChecksum verify check sum flag.\n   * @throws AccessControlException access control exception.\n   * @throws IOException raised on errors performing I/O.\n   */\n  public abstract void setVerifyChecksum(final boolean verifyChecksum)\n      throws AccessControlException, IOException;\n  \n  /**\n   * Get a canonical name for this file system.","sourceCodeStart":1204,"sourceCodeEnd":1240,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L1204-L1240","documentation":"Corrupt-block tracking is an HDFS concept (the NameNode records blocks whose replicas fail verification); AbstractFileSystem.listCorruptFileBlocks defaults to UnsupportedOperationException, and only the HDFS AFS (plus pass-through wrappers like FilterFs/ChRootedFs/ViewFs) overrides it. FileContext exposes the same call at fc.listCorruptFileBlocks(path), so health tools hit this on every non-HDFS backend.","triggerScenarios":"fc.listCorruptFileBlocks(path) on file://, s3a://, or any non-HDFS scheme; HDFS health-check utilities executed against the local filesystem in unit tests; dashboards parameterized over fs.defaultFS that probe corrupt blocks generically.","commonSituations":"Cluster health tooling written against HDFS run against other stores; test suites exercising admin code paths on LocalFs; code copied from DistributedFileSystem-based fsck implementations.","solutions":["Restrict the call to hdfs:// paths by checking the scheme before invoking","For real checks use 'hdfs fsck' or DistributedFileSystem.listCorruptFileBlocks() on an HDFS client","Probe the path capability CommonPathCapabilities.FS_LIST_CORRUPT_FILE_BLOCKS via hasPathCapability before calling"],"exampleFix":"// before\nRemoteIterator<Path> it = fc.listCorruptFileBlocks(path); // non-HDFS -> UOE\n\n// after\nif (fc.hasPathCapability(path,\n        CommonPathCapabilities.FS_LIST_CORRUPT_FILE_BLOCKS)) {\n  RemoteIterator<Path> it = fc.listCorruptFileBlocks(path);\n}","handlingStrategy":"validation","validationCode":"if (fc.hasPathCapability(path,\n        CommonPathCapabilities.FS_LIST_CORRUPT_FILE_BLOCKS)) {\n  RemoteIterator<Path> it = fc.listCorruptFileBlocks(path);\n}","typeGuard":"boolean isHdfsScheme(Path p) {\n  String s = p.toUri().getScheme();\n  return s == null ? \"hdfs\".equals(conf.get(\"fs.defaultFS\", \"\").split(\":\")[0]) : \"hdfs\".equals(s);\n}","tryCatchPattern":"try { fc.listCorruptFileBlocks(path); } catch (UnsupportedOperationException e) { /* corrupt-block tracking is HDFS-only: skip check */ }","preventionTips":["Treat corrupt-block monitoring as an HDFS-only feature and gate it by scheme or capability","Run HDFS admin tool tests against miniDFS, not LocalFs","Probe fs.capability.paths.list-corrupt-file-blocks before calling on user-supplied paths"],"tags":["corrupt-blocks","unsupported-feature","hdfs-only","fsck","hadoop-fs"],"backgroundTag":"filesystem-capability-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}