haohao0103 commented on code in PR #5064:
URL: https://github.com/apache/hbase/pull/5064#discussion_r1121961415
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java:
##########
@@ -203,20 +202,21 @@ public static FSDataOutputStream create(Configuration
conf, FileSystem fs, Path
short replication =
Short.parseShort(conf.get(ColumnFamilyDescriptorBuilder.DFS_REPLICATION,
String.valueOf(ColumnFamilyDescriptorBuilder.DEFAULT_DFS_REPLICATION)));
try {
- return (FSDataOutputStream) (DistributedFileSystem.class
- .getDeclaredMethod("create", Path.class, FsPermission.class,
boolean.class, int.class,
- short.class, long.class, Progressable.class,
InetSocketAddress[].class)
- .invoke(backingFs, path, perm, true,
CommonFSUtils.getDefaultBufferSize(backingFs),
- replication > 0 ? replication :
CommonFSUtils.getDefaultReplication(backingFs, path),
- CommonFSUtils.getDefaultBlockSize(backingFs, path), null,
favoredNodes));
- } catch (InvocationTargetException ite) {
- // Function was properly called, but threw it's own exception.
- throw new IOException(ite.getCause());
- } catch (NoSuchMethodException e) {
+ DistributedFileSystem dfs = (DistributedFileSystem) backingFs;
+ DistributedFileSystem.HdfsDataOutputStreamBuilder builder =
dfs.createFile(path)
+ .permission(perm).create().overwrite(true)
+ .bufferSize(CommonFSUtils.getDefaultBufferSize(backingFs))
+ .replication(
+ replication > 0 ? replication :
CommonFSUtils.getDefaultReplication(backingFs, path))
+ .blockSize(CommonFSUtils.getDefaultBlockSize(backingFs, path));
+ if (favoredNodes != null) {
+ builder.favoredNodes(favoredNodes);
+ }
+ builder.recursive();
+ return builder.build();
+ } catch (IllegalArgumentException | SecurityException e) {
Review Comment:
Thanks, I see. I have removed the RuntimeExceptions
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]