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

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

github-actions[bot] closed pull request #6080: HADOOP-18904. get local file 
system fails with a casting error
URL: https://github.com/apache/hadoop/pull/6080




> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to