You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2025/10/11 00:22:00 UTC

[jira] [Commented] (HADOOP-18904) get local file system fails with a casting error

    [ https://issues.apache.org/jira/browse/HADOOP-18904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18029137#comment-18029137 ] 

ASF GitHub Bot commented on HADOOP-18904:
-----------------------------------------

github-actions[bot] commented on PR #6080:
URL: https://github.com/apache/hadoop/pull/6080#issuecomment-3392652856

   We're closing this stale PR because it has been open for 100 days with no activity. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you feel like this was a mistake, or you would like to continue working on it, please feel free to re-open it and ask for a committer to remove the stale tag and review again.
   Thanks all for your contribution.




> get local file system fails with a casting error
> ------------------------------------------------
>
>                 Key: HADOOP-18904
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18904
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 3.3.6
>            Reporter: ConfX
>            Priority: Trivial
>              Labels: pull-request-available
>
> h2. What happened
> After setting {{{}fs.file.impl=org.apache.hadoop.fs.RawLocalFileSystem{}}}, trying to acquire local file system using the {{getLocal}} in {{org.apache.hadoop.fs}} fails with {{java.lang.ClassCastException}}
> h2. Where's the bug
> In the function {{getLocal}} of {{FileSystem}} in HCommon:
> {code:java}
>   public static LocalFileSystem getLocal(Configuration conf)
>     throws IOException {
>     return (LocalFileSystem)get(LocalFileSystem.NAME, conf);
>   } {code}
> the returned file system is directly cast to LocalFileSystem without checking. If the user set the implementation of the local filesystem to be Raw rather than Checksum, this type cast would fail.
> h2. How to reproduce
>  # Set {{fs.file.impl=org.apache.hadoop.fs.RawLocalFileSystem}}
>  # Run the following test in HBase: {{org.apache.hadoop.hbase.TestHBaseTestingUtility#testMiniDFSCluster}}
> and the following exception should be observed:
> {code:java}
> java.lang.ClassCastException: class org.apache.hadoop.fs.RawLocalFileSystem cannot be cast to class org.apache.hadoop.fs.LocalFileSystem (org.apache.hadoop.fs.RawLocalFileSystem and org.apache.hadoop.fs.LocalFileSystem are in unnamed module of loader 'app')
> 	at org.apache.hadoop.fs.FileSystem.getLocal(FileSystem.java:441)
> 	at org.apache.hadoop.hbase.HBaseTestingUtility.getNewDataTestDirOnTestFS(HBaseTestingUtility.java:550)
> ...{code}
> Or simply set the configuration parameter and call the method using a {{Configuration}} object and the exception would be triggered.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org