[
https://issues.apache.org/jira/browse/HDFS-16567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530733#comment-17530733
]
Congyong Ruan edited comment on HDFS-16567 at 5/5/22 2:20 AM:
--------------------------------------------------------------
when calling create file method, there are initialization FSPermission
parameters inside the create method in DFSClient class. We can see it in
DFSClient class applyUMask method. Code show as below
{code:java}
//代码占位符
public DFSOutputStream create(String src, FsPermission permission,
EnumSet<CreateFlag> flag, boolean createParent, short replication, long
blockSize, Progressable progress, int buffersize, ChecksumOpt checksumOpt,
InetSocketAddress[] favoredNodes, String ecPolicyName, String storagePolicy)
throws IOException { checkOpen(); final FsPermission masked =
applyUMask(permission); LOG.debug("{}: masked={}", src, masked); final
DFSOutputStream result = DFSOutputStream.newStreamForCreate(this, src, masked,
flag, createParent, replication, blockSize, progress,
dfsClientConf.createChecksum(checksumOpt), getFavoredNodesStr(favoredNodes),
ecPolicyName, storagePolicy); beginFileLease(result.getFileId(), result);
return result; }
private FsPermission applyUMask(FsPermission permission) {
if (permission == null) {
permission = FsPermission.getFileDefault();
}
return FsCreateModes.applyUMask(permission, dfsClientConf.getUMask());
} {code}
was (Author: JIRAUSER288876):
when calling create file method, there are initialization FSPermission
parameters inside the create method in DFSClient class. We can see it in
DFSClient class applyUMask method. Code show as below
{code:java}
//代码占位符
private FsPermission applyUMask(FsPermission permission) {
if (permission == null) {
permission = FsPermission.getFileDefault();
}
return FsCreateModes.applyUMask(permission, dfsClientConf.getUMask());
} {code}
> A NullPointerException occurs when calling setPermission and permission is
> null
> --------------------------------------------------------------------------------
>
> Key: HDFS-16567
> URL: https://issues.apache.org/jira/browse/HDFS-16567
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs-client
> Reporter: Congyong Ruan
> Priority: Minor
> Fix For: 3.3.2
>
>
> when calling setPermission and permission parameter is null, a
> NullPointerException will occurs. According to the [official
> manual,|https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html]
> the method doesn't say that the parameter is not empty. when without the
> permission parameter the mode of new directory is {{P & ^umask & 0777 and
> the mode of the new file is }}{{P & ^umask & 0666}}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]